/* Executes keys from the start of key sequence or at some offset in it. * Returns error code. */ static int dispatch_keys(const wchar_t keys[], keys_info_t *keys_info, int no_remap, int prev_count) { key_info_t key_info; int result; if(fill_key_info(&keys, &key_info, prev_count, &result) != 0) { return result; } result = KEYS_UNKNOWN; if(!no_remap) { result = dispatch_keys_at_root(keys, keys_info, &user_cmds_root[vle_mode_get()], key_info, no_remap); } if(result == KEYS_UNKNOWN) { result = dispatch_keys_at_root(keys, keys_info, &builtin_cmds_root[vle_mode_get()], key_info, no_remap); } return result; }
/* Executes keys from the start of key sequence or at some offset in it. * Returns error code. */ static int dispatch_keys(const wchar_t keys[], keys_info_t *keys_info, int no_remap, int prev_count) { key_info_t key_info; int result; keys = get_reg(keys, &key_info.reg); if(keys == NULL) { return KEYS_WAIT; } if(key_info.reg == L'\x1b' || key_info.reg == L'\x03') { return 0; } keys = get_count(keys, &key_info.count); key_info.count = combine_counts(key_info.count, prev_count); key_info.multi = L'\0'; if(!no_remap) { key_chunk_t *const root = keys_info->selector ? &selectors_root[vle_mode_get()] : &user_cmds_root[vle_mode_get()]; result = dispatch_keys_at_root(keys, keys_info, root, key_info, no_remap); } else { result = KEYS_UNKNOWN; } if(result == KEYS_UNKNOWN && !keys_info->selector) { result = dispatch_keys_at_root(keys, keys_info, &builtin_cmds_root[vle_mode_get()], key_info, no_remap); } return result; }