fix(core): clear core context on invalidate cache

This commit is contained in:
rc-swag 2023-12-12 23:49:04 +10:00
parent 83e21333c6
commit 4a511bde1e
6 changed files with 28 additions and 1 deletions

View file

@ -323,5 +323,12 @@
<FileVersion>1.0</FileVersion>
<FileType>.kmn</FileType>
</File>
<File>
<ID>id_k_049___context_and_invalidate</ID>
<Filename>k_049___context_and_invalidate.kmn</Filename>
<Filepath>k_049___context_and_invalidate.kmn</Filepath>
<FileVersion>1.0</FileVersion>
<FileType>.kmn</FileType>
</File>
</Files>
</KeymanDeveloperProject>

View file

@ -0,0 +1,16 @@
store(&NAME) '049 - context and invalidate'
c Description: Tests that core context is cleared when invalidated See #10182.
c keys: [K_A][K_B][K_ENTER][K_C]
c expected: c
c context:
store(&version) '10.0'
begin Unicode > use(Main)
group(Main) using keys
c Test if context was not invalidated by [K_ENTER] context will be 'abd'
'a' 'b' + [K_C] > 'abd'

View file

@ -247,6 +247,7 @@ kmx_processor::internal_process_queued_actions(km_core_state *state) {
}
break;
case QIT_INVALIDATECONTEXT:
state->context().clear();
state->actions().push_invalidate_context();
break;
default:

View file

@ -147,6 +147,8 @@ apply_action(
}
} break;
case KM_CORE_IT_INVALIDATE_CONTEXT:
context.clear();
text_store.clear();
std::cout << "action: context invalidated (markers cleared)" << std::endl;
break;
case KM_CORE_IT_EMIT_KEYSTROKE:

View file

@ -79,7 +79,8 @@ tests = [
'k_045___deadkey_and_context',
'k_046___deadkey_and_contextex',
'k_047___caps_always_off_initially_on',
'k_048___modifier_keys_keep_context'
'k_048___modifier_keys_keep_context',
'k_049___context_and_invalidate'
]
node = find_program('node', required: true)