mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-15 08:21:03 -04:00
input: match unshifted key-bindings before shifted
That is, try to match e.g. Control+shift+a, before trying to match Control+A. In most cases, order doesn't matter. There are however a couple of symbols where the layout consumes the shift-modifier, and the generated symbol is the same in both the shifted and unshifted form. One such example is backspace. Before this patch, key-bindings with shift-backspace would be ignored, if there were another key-binding with backspace. So, for example, if we had one key-binding with Control+Backspace, and another with Control+Shift+Backspace, the latter would never trigger, as we would always match the first one. By checking for unshifted matches first, we ensure Control+Shift+Backspace does match.
This commit is contained in:
parent
bee17a95b8
commit
51128a3484
3 changed files with 42 additions and 42 deletions
24
input.c
24
input.c
|
|
@ -1584,18 +1584,6 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
|
||||||
* User configurable bindings
|
* User configurable bindings
|
||||||
*/
|
*/
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
/* Match translated symbol */
|
|
||||||
tll_foreach(bindings->key, it) {
|
|
||||||
const struct key_binding *bind = &it->item;
|
|
||||||
|
|
||||||
if (bind->k.sym == sym &&
|
|
||||||
bind->mods == (mods & ~consumed) &&
|
|
||||||
execute_binding(seat, term, bind, serial, 1))
|
|
||||||
{
|
|
||||||
goto maybe_repeat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Match untranslated symbols */
|
/* Match untranslated symbols */
|
||||||
tll_foreach(bindings->key, it) {
|
tll_foreach(bindings->key, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
@ -1612,6 +1600,18 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Match translated symbol */
|
||||||
|
tll_foreach(bindings->key, it) {
|
||||||
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
||||||
|
if (bind->k.sym == sym &&
|
||||||
|
bind->mods == (mods & ~consumed) &&
|
||||||
|
execute_binding(seat, term, bind, serial, 1))
|
||||||
|
{
|
||||||
|
goto maybe_repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Match raw key code */
|
/* Match raw key code */
|
||||||
tll_foreach(bindings->key, it) {
|
tll_foreach(bindings->key, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
|
||||||
34
search.c
34
search.c
|
|
@ -1392,23 +1392,6 @@ search_input(struct seat *seat, struct terminal *term,
|
||||||
* Key bindings
|
* Key bindings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Match translated symbol */
|
|
||||||
tll_foreach(bindings->search, it) {
|
|
||||||
const struct key_binding *bind = &it->item;
|
|
||||||
|
|
||||||
if (bind->k.sym == sym &&
|
|
||||||
bind->mods == (mods & ~consumed)) {
|
|
||||||
|
|
||||||
if (execute_binding(seat, term, bind, serial,
|
|
||||||
&update_search_result, &search_direction,
|
|
||||||
&redraw))
|
|
||||||
{
|
|
||||||
goto update_search;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Match untranslated symbols */
|
/* Match untranslated symbols */
|
||||||
tll_foreach(bindings->search, it) {
|
tll_foreach(bindings->search, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
@ -1429,6 +1412,23 @@ search_input(struct seat *seat, struct terminal *term,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Match translated symbol */
|
||||||
|
tll_foreach(bindings->search, it) {
|
||||||
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
||||||
|
if (bind->k.sym == sym &&
|
||||||
|
bind->mods == (mods & ~consumed)) {
|
||||||
|
|
||||||
|
if (execute_binding(seat, term, bind, serial,
|
||||||
|
&update_search_result, &search_direction,
|
||||||
|
&redraw))
|
||||||
|
{
|
||||||
|
goto update_search;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Match raw key code */
|
/* Match raw key code */
|
||||||
tll_foreach(bindings->search, it) {
|
tll_foreach(bindings->search, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
|
||||||
26
url-mode.c
26
url-mode.c
|
|
@ -182,19 +182,6 @@ urls_input(struct seat *seat, struct terminal *term,
|
||||||
* Key bindings
|
* Key bindings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Match translated symbol */
|
|
||||||
tll_foreach(bindings->url, it) {
|
|
||||||
const struct key_binding *bind = &it->item;
|
|
||||||
|
|
||||||
if (bind->k.sym == sym &&
|
|
||||||
bind->mods == (mods & ~consumed))
|
|
||||||
{
|
|
||||||
execute_binding(seat, term, bind, serial);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Match untranslated symbols */
|
/* Match untranslated symbols */
|
||||||
tll_foreach(bindings->url, it) {
|
tll_foreach(bindings->url, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
@ -209,6 +196,19 @@ urls_input(struct seat *seat, struct terminal *term,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Match translated symbol */
|
||||||
|
tll_foreach(bindings->url, it) {
|
||||||
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
||||||
|
if (bind->k.sym == sym &&
|
||||||
|
bind->mods == (mods & ~consumed))
|
||||||
|
{
|
||||||
|
execute_binding(seat, term, bind, serial);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Match raw key code */
|
/* Match raw key code */
|
||||||
tll_foreach(bindings->url, it) {
|
tll_foreach(bindings->url, it) {
|
||||||
const struct key_binding *bind = &it->item;
|
const struct key_binding *bind = &it->item;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue