-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): reset on frame keys 🙀 #11172
Merged
Merged
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
c86ab58
chore(core): reinstate context reset test in ldml
srl295 c91095f
fix(core): core to automatically reset context if a frame key pressed
srl295 2298f11
Merge branch 'chore/core/11112-lone-surrogate' into fix/core/10955-re…
srl295 f1b0d8c
fix(core): core to automatically reset context if a frame key pressed
srl295 628d13d
fix(core): core to automatically reset context if a frame key pressed
srl295 784a994
fix(core): update ldml test source to handle reset
srl295 55483e4
fix(core): update ldml test source to handle reset
srl295 a455c5b
fix(core): update core to handle reset context
srl295 11b0712
fix(core): update core to handle reset context
srl295 111a50c
fix(core): dx: denoise test
srl295 51c93ac
fix(core): update core to handle reset context
srl295 3da900d
Merge branch 'chore/core/11112-lone-surrogate' into fix/core/10955-re…
srl295 9ca4e99
fix(core): update core to handle reset context
srl295 d0ca92a
Merge branch 'beta' into fix/core/10955-reset-on-frame
srl295 46239c6
Update core/src/state.hpp
srl295 bd10290
fix(core): update core to handle reset context
srl295 699d576
Merge branch 'beta' into fix/core/10955-reset-on-frame
srl295 4f8c9eb
fix(core): update core to handle reset context
srl295 37530ac
fix(core): update core to handle reset context
srl295 5c04599
Merge branch 'beta' into fix/core/10955-reset-on-frame
srl295 4f2ef49
fix(core): update core to handle reset context
srl295 8d35422
Merge branch 'beta' into fix/core/10955-reset-on-frame
srl295 f77bbb2
fix(core): update state_should_invalidate_context
srl295 331ff33
Merge branch 'beta' into fix/core/10955-reset-on-frame
srl295 ba8dcad
Apply suggestions from code review
srl295 f516538
chore(core): outdent test file per review comment
srl295 cd867ba
fix(core): update vkey_should_invalidate_context per comment
srl295 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,7 +20,8 @@ | |||||
|
||||||
#include "processor.hpp" | ||||||
#include "state.hpp" | ||||||
|
||||||
#include "vkey_to_contextreset.hpp" | ||||||
#include "kmx_file.h" | ||||||
|
||||||
using namespace km::core; | ||||||
|
||||||
|
@@ -363,4 +364,35 @@ km_core_cp * km_core_state_context_debug( | |||||
result[s.size()] = 0; | ||||||
|
||||||
return result; | ||||||
} | ||||||
} | ||||||
|
||||||
static bool | ||||||
state_has_action_type(km_core_state *state, uint8_t type) { | ||||||
return std::any_of( | ||||||
state->actions().begin(), state->actions().end(), | ||||||
[type](const km::core::action &a) { return a.type == type; }); | ||||||
} | ||||||
|
||||||
bool | ||||||
state_should_invalidate_context(km_core_state *state, | ||||||
km_core_virtual_key vk, | ||||||
uint16_t modifier_state, | ||||||
uint8_t is_key_down, | ||||||
uint16_t _kmn_unused(event_flags)) { | ||||||
if (!is_key_down) { | ||||||
return false; // don't invalidate on keyup | ||||||
} | ||||||
// if emit_keystroke is present, check if a context reset is needed | ||||||
if (state_has_action_type(state, KM_CORE_IT_EMIT_KEYSTROKE)) { | ||||||
if ( | ||||||
srl295 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// always reset on backspace | ||||||
vk == KM_CORE_VKEY_BKSP || | ||||||
srl295 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// certain modifiers reset | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should call this |
||||||
modifier_should_contextreset(modifier_state) || | ||||||
srl295 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// reset on frame keys | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
vkey_should_contextreset(vk)) { | ||||||
return true; | ||||||
} | ||||||
} | ||||||
return false; | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to add some explanation of why we are doing this -- why do we need to add the invalidate context before emit keystroke, etc.