On Wed, Feb 23, 2005 at 12:02:41PM +0000, Colin Watson wrote:
> Going back to xterm compatibility and surveying the available
> LinuxFunctionKeys modes in pterm, "pterm.LinuxFunctionKeys: 5" (a.k.a.
> FUNKY_SCO) appears to match xterm's current behaviour for Home/End, but
> very little else; Insert/Delete/PageUp/PageDown match xterm in
> LinuxFunctionKeys modes 0 (FUNKY_TILDE), 1 (FUNKY_LINUX), 2
> (FUNKY_XTERM), and 4 (FUNKY_VT100P).
> 
> Here's a patch that makes pterm emit sequences that match current xterm
> in FUNKY_XTERM mode. If you don't want to apply it without making it
> configurable as well, would you mind if I applied this at least in
> Debian, so that we're in sync with the way other Debian terminal
> emulators behave?

I've been belatedly revisiting this bug today.  I've used
TERM=putty-256color as a workaround for this sort of thing for a long
time, but that has some other significant annoyances: I'm forever having
to set TERM=xterm-256color for various applications, and that's what
PuTTY's own documentation recommends, so I'd like to get back to it.
However, having Home and End not work in my editor (compare
https://github.com/neovim/neovim/issues/6014) is indescribably annoying.

This updated version of my patch from 2005 seems to work to align PuTTY
a bit more closely with "modern" xterm behaviour (r6 and onwards); but I
make no claim to having extensively vetted its compliance with the
official terminfo entries, as I'm afraid I find terminfo rather
impenetrable!

diff --git a/terminal/terminal.c b/terminal/terminal.c
index 584bd3e6..26759193 100644
--- a/terminal/terminal.c
+++ b/terminal/terminal.c
@@ -7617,6 +7617,10 @@ int format_small_keypad_key(char *buf, Terminal *term, 
SmallKeypadKey key,
         }
     } else if ((code == 1 || code == 4) && term->rxvt_homeend) {
         p += sprintf(p, code == 1 ? "\x1B[H" : "\x1BOw");
+    } else if ((code == 1 || code == 4) &&
+               (term->funky_type == FUNKY_XTERM ||
+                term->funky_type == FUNKY_XTERM_216)) {
+        p += sprintf(p, code == 1 ? "\x1B[H" : "\x1B[F");
     } else {
         if (term->vt52_mode) {
            p += sprintf(p, "\x1B[%d~", code);

Thanks,

-- 
Colin Watson (he/him)                              [cjwat...@debian.org]

Reply via email to