Skip to content

Commit

Permalink
chore(core): address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdurdin committed Dec 4, 2023
1 parent b6daac0 commit 802f225
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool km::core::state::set_actions(
// number of codepoints (not codeunits!) to delete from app context.

for(unsigned int i = 0; i < actions.code_points_to_delete; i++) {
_actions.push_backspace(KM_CORE_BT_CHAR, 0); //(*end).character);
_actions.push_backspace(KM_CORE_BT_CHAR, 0); // expected value is not known
}

for(auto output = actions.output; *output; output++) {
Expand Down
7 changes: 7 additions & 0 deletions core/src/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ class state

void imx_callback(uint32_t imx_id);

// This is intended to be used to take the actions given in the actions
// parameter, and load them into the _actions member of this class. Used by
// keyboard processors to set the output actions, and is a long-term
// replacement for the actions()::push_*() functions. Note that the
// km_core_actions struct does not include information about markers, which
// are maintained separately in the _ctxt member of this class, and the
// corresponding marker-backspace action items are never used here.
bool set_actions(
km_core_actions const &actions
);
Expand Down
24 changes: 24 additions & 0 deletions core/tests/unit/kmnkbd/action_set_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,29 @@ void test_persist_opt() {
run_test(action_items, actions);
}

//-------------------------------------------------------------------------------------

void test_caps_lock() {
puts("test_caps_lock");

const km_core_action_item action_items[] = {
caps_action_item(KM_CORE_CAPS_ON),
// invalidate_context_action_item(),
end_action_item()
};

const km_core_actions actions = {
0, // unsigned int code_points_to_delete;
test_empty_output, // km_core_usv* output;
test_env_opts, // km_core_option_item* persist_options;
KM_CORE_FALSE, // km_core_bool do_alert;
KM_CORE_FALSE, // km_core_bool emit_keystroke;
KM_CORE_CAPS_ON // new_caps_lock_state;
};

run_test(action_items, actions);
}

//-------------------------------------------------------------------------------------
// Launcher
//-------------------------------------------------------------------------------------
Expand Down Expand Up @@ -289,6 +312,7 @@ int main(int argc, char *argv []) {
test_emit_keystroke();
test_invalidate_context();
test_persist_opt();
test_caps_lock();
}

//-------------------------------------------------------------------------------------
Expand Down

0 comments on commit 802f225

Please sign in to comment.