summaryrefslogtreecommitdiff
path: root/src/compose/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compose/state.c')
-rw-r--r--src/compose/state.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compose/state.c b/src/compose/state.c
index de08a90..6ba0344 100644
--- a/src/compose/state.c
+++ b/src/compose/state.c
@@ -109,17 +109,20 @@ xkb_compose_state_feed(struct xkb_compose_state *state, xkb_keysym_t keysym)
node = &darray_item(state->table->nodes, state->context);
- context = (node->is_leaf ? 0 : node->internal.successor);
- node = &darray_item(state->table->nodes, context);
+ context = (node->is_leaf ? 1 : node->internal.eqkid);
+ if (context == 1 && darray_size(state->table->nodes) == 1)
+ context = 0;
- while (node->keysym != keysym && node->next != 0) {
- context = node->next;
+ while (context != 0) {
node = &darray_item(state->table->nodes, context);
+ if (keysym < node->keysym)
+ context = node->lokid;
+ else if (keysym > node->keysym)
+ context = node->hikid;
+ else
+ break;
}
- if (node->keysym != keysym)
- context = 0;
-
state->prev_context = state->context;
state->context = context;
return XKB_COMPOSE_FEED_ACCEPTED;