This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit e9417d3627dc3fd7682b548244c3f9f38b02fde8
Author: Boris Faure <[email protected]>
AuthorDate: Wed Nov 18 21:41:11 2026 +0000
termpty: drop key repeats with DECARM reset
DECARM (CSI ? 8 l) told a repeat by a key-down sharing the timestamp of
the previous key-up. That only holds where autorepeat sends a release
before each press: ecore_x turns on detectable autorepeat and Wayland
repeats are presses alone, so repeats always reached the pty.
The pressed-key table now tells a repeat apart for any platform; the
timestamp check stays for X servers without detectable autorepeat.
---
src/bin/keyin.h | 3 ++-
src/bin/termpty.c | 51 +++++++++++++++++++++++++++++++++++++++++++--------
src/bin/tytest.c | 1 +
src/bin/unit_tests.h | 1 +
src/bin/win.c | 8 ++++----
5 files changed, 51 insertions(+), 13 deletions(-)
diff --git a/src/bin/keyin.h b/src/bin/keyin.h
index 7b75ee7a..c0a3f2b9 100644
--- a/src/bin/keyin.h
+++ b/src/bin/keyin.h
@@ -48,7 +48,8 @@ void keyin_pressed_reset(Keys_Handler *khdl);
Eina_Bool
termpty_can_handle_key(const Termpty *ty,
const Keys_Handler *khdl,
- const Evas_Event_Key_Down *ev);
+ const Evas_Event_Key_Down *ev,
+ Keyin_Action action);
void keyin_compose_seq_reset(Keys_Handler *khdl);
Eina_Bool key_is_modifier(const char *key);
Eina_Bool
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index fc8ef5ee..c3c952dc 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -73,7 +73,8 @@ termpty_shutdown(void)
Eina_Bool
termpty_can_handle_key(const Termpty *ty,
const Keys_Handler *khdl,
- const Evas_Event_Key_Down *ev)
+ const Evas_Event_Key_Down *ev,
+ Keyin_Action action)
{
// if term app asked for kbd lock - don't handle here
if (ty->termstate.kbd_lock)
@@ -81,7 +82,8 @@ termpty_can_handle_key(const Termpty *ty,
// if app asked us to not do autorepeat - ignore press if is it is the same
// timestamp as last one
if ((ty->termstate.no_autorepeat) &&
- (ev->timestamp == khdl->last_keyup))
+ ((action == KEYIN_ACTION_REPEAT) ||
+ (ev->timestamp == khdl->last_keyup)))
return EINA_FALSE;
return EINA_TRUE;
}
@@ -3359,21 +3361,54 @@ tytest_kam(void)
_ty_test_init(&ty, 80, 24);
_ty_feed(&ty, "\x1b[?2h");
- assert(termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
_ty_feed(&ty, "\x1b[?2l");
- assert(termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
_ty_feed(&ty, "\x1b[2h");
- assert(!termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(!termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
_ty_feed(&ty, "\x1b[2$p");
_ty_reply_is(&ty, "\x1b[2;1$y");
_ty_feed(&ty, "\x1b[2l");
- assert(termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
_ty_feed(&ty, "\x1b[2h\x1b[!p");
- assert(termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
_ty_feed(&ty, "\x1b[2h\x1b" "c");
- assert(termpty_can_handle_key(&ty, &khdl, &ev));
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
+
+ _ty_test_shutdown(&ty);
+ return 0;
+}
+
+/* With DECARM reset, a repeat is dropped. Platforms with detectable
+ * autorepeat send it as a press of a key still held; the others as a
+ * release and a press sharing a timestamp. */
+int
+tytest_decarm(void)
+{
+ Termpty ty;
+ Keys_Handler khdl = { 0 };
+ Evas_Event_Key_Down ev = { 0 };
+
+ ev.timestamp = 2;
+ _ty_test_init(&ty, 80, 24);
+
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_REPEAT));
+
+ _ty_feed(&ty, "\x1b[?8l");
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
+ assert(!termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_REPEAT));
+ khdl.last_keyup = 2;
+ assert(!termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_PRESS));
+ khdl.last_keyup = 1;
+
+ _ty_feed(&ty, "\x1b[?8h");
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_REPEAT));
+
+ /* RIS sets DECARM back */
+ _ty_feed(&ty, "\x1b[?8l\x1b" "c");
+ assert(termpty_can_handle_key(&ty, &khdl, &ev, KEYIN_ACTION_REPEAT));
_ty_test_shutdown(&ty);
return 0;
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 872348e6..453a1c0e 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -98,6 +98,7 @@ static struct {
{ "decrqss_settings", tytest_decrqss_settings},
{ "decrqm", tytest_decrqm},
{ "kam", tytest_kam},
+ { "decarm", tytest_decarm},
{ "color_scheme_notify", tytest_color_scheme_notify},
{ "kitty_kbd_query", tytest_kitty_kbd_query},
{ "kitty_kbd_stack", tytest_kitty_kbd_stack},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index c92bf460..63bf70aa 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -71,6 +71,7 @@ int tytest_decrqss_sgr(void);
int tytest_decrqss_settings(void);
int tytest_decrqm(void);
int tytest_kam(void);
+int tytest_decarm(void);
int tytest_color_scheme_notify(void);
int tytest_kitty_kbd_query(void);
int tytest_kitty_kbd_stack(void);
diff --git a/src/bin/win.c b/src/bin/win.c
index 07e83ac9..85e9bcec 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -2171,14 +2171,14 @@ _cb_win_key_down(void *data,
GROUPED_INPUT_TERM_FOREACH(wn, l, term)
{
ty = termio_pty_get(term->termio);
- if (ty && termpty_can_handle_key(ty, &wn->khdl, ev))
+ if (ty && termpty_can_handle_key(ty, &wn->khdl, ev, action))
termpty_write(ty, compres, len);
}
}
else
{
ty = termio_pty_get(term->termio);
- if (ty && termpty_can_handle_key(ty, &wn->khdl, ev))
+ if (ty && termpty_can_handle_key(ty, &wn->khdl, ev, action))
termpty_write(ty, compres, len);
}
free(compres);
@@ -2196,7 +2196,7 @@ _cb_win_key_down(void *data,
GROUPED_INPUT_TERM_FOREACH(wn, l, term)
{
ty = termio_pty_get(term->termio);
- if (ty && termpty_can_handle_key(ty, &wn->khdl, ev))
+ if (ty && termpty_can_handle_key(ty, &wn->khdl, ev, action))
{
termpty_program_status_drop_unseen(ty);
keyin_handle_key_to_pty(ty, &wn->khdl, ev, action);
@@ -2207,7 +2207,7 @@ _cb_win_key_down(void *data,
{
ty = termio_pty_get(term->termio);
DBG("ty:%p", ty);
- if (ty && termpty_can_handle_key(ty, &wn->khdl, ev))
+ if (ty && termpty_can_handle_key(ty, &wn->khdl, ev, action))
{
termpty_program_status_drop_unseen(ty);
keyin_handle_key_to_pty(ty, &wn->khdl, ev, action);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.