Question

I'm giving emacs a go, and running it in mintty / Cygwin on Windows.

I'm running emacs version 24.3.1.

I've found that emacs uses ephemeral mode text selection by default these days, with Shift + arrow keys used for selecting text, like most modern UIs.

However, there is one key binding that isn't working inside mintty: Shift+Up.

How do I get it to work?

Was it helpful?

Solution

I figured it was something wrong in the terminfo settings for xterm, which is what mintty emulates.

I used esr's showkey to dump what the terminal was sending for Shift-Up, Shift-Down:

^[ 1 ; 2 A   shift-up
^[ 1 ; 2 B   shift-down

I decompiled the terminfo entries for xterm (which didn't work properly) and rxvt (which did, when run in an rxvt terminal) with infocmp -L xterm and infocmp -L rxvt, and noticed that the sequences above were mapped for xterm to key_sr (kind) and key_sf (kri) - see the definition of those guys here. But rxvt had no such entries.

So I tweaked the entries:

$ infocmp xterm > xterm.ti

Applied this change:

-       kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
-       kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
+       kmous=\E[M, knp=\E[6~, kpp=\E[5~,
+       mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,

Compiled and installed updated xterm:

$ tic xterm.ti

This fixed selection with Shift+Up in emacs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top