[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] set the terminal emulator's titlebar
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] set the terminal emulator's titlebar |
Date: |
Tue, 30 Jan 2018 21:20:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
Op 29-01-18 om 22:21 schreef Mike Frysinger:
the fgconsole tool from kbd uses the ioctl VT_GETSTATE to determine whether
the terminal is a linux virtual terminal. seems like you could do that here
too instead of checking $DISPLAY.
Will look into that.
you're right that it'd still break down
if you were to ssh out or launch screen/tmux or something, but i don't think
there's any sane way around that, and i'm not aware of any other program off
hand that attempts to handle this. imo we shouldn't either.
Vim nor Emacs nor Pico appear to distinguish <Ctrl+Left> from <Left>.
But as said: I found it too stupid that nano didn't distinguish them.
(On a previous machine, I had adjusted the console keymap to make
<Ctrl+Left> produce ^B and <Ctrl+Right> produce ^F and via inputrc
bound them to backward_word and forward_word, and via nanorc to
prevword and nextword. So for me those two Ctrl+Arrow keystrokes
have worked for a long time on the console, even at the prompt.
On my new machine, I wanted them (and others) to work out of the
box, at least in nano.)
<Left>, <Shift+Left>, <Ctrl+Left> on a Linux console:
Sequence of hex codes: 104
Sequence of hex codes: 104
Sequence of hex codes: 104
<Left>, <Shift+Left>, <Ctrl+Left> on an Xfce Terminal:
Sequence of hex codes: 104
Sequence of hex codes: 189
Sequence of hex codes: 221
i'm not sure what you mean here by hex codes.
That's from a fragment of debugging code in src/winio.c. When I want
to look at keycodes, I comment the #ifdef DEBUG and #endif around the
"hex codes" fragment, and run 'src/nano 2>TRAIL; cat TRAIL' and type
some keys followed by ^X, and check what codes were produced.
here's what xterm shows:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Alt-and-Meta-Keys
so <Left> generates CUD sequences with modifiers in them:
I think you mean CUB sequences? (Cursor Backward)
<Left>: esc [ D
NB: the default with CUD is 1, not 0, so it'd be the same as:
<Left>: esc [ 1 D
<Shift+Left>: esc [ 1 ; 2 D
<Ctrl+Left>: esc [ 1 ; 5 D
When using option -K (which stops nano from putting ncurses in keypad
mode), the produced sequences are as you say, on an Xfce Terminal:
<Left>: 1b 5b 44
<Shift+Left>: 1b 5b 31 3b 32 44
<Ctrl+Left>: 1b 5b 31 3b 35 44
On a Linux console:
<Left>: 1b 5b 44
<Shift+Left>: 1b 5b 44
<Ctrl+Left>: 1b 5b 44
i have one patch pending for the linux vt ... lemme try sending it out and
see how receptive people are to updating things. maybe we can get newer
kernel versions to emit the additional sequences in line and then we can
stop dealing with it ourselves.
That would be great. But even if the Linux console becomes a better
terminal by default, it will take years for such a kernel to become
common in distros, Until then I'm keeping the workaround in nano.
Benno
- Re: [Nano-devel] set the terminal emulator's titlebar, Mike Frysinger, 2018/01/27
- Re: [Nano-devel] set the terminal emulator's titlebar, Brand Huntsman, 2018/01/27
- Re: [Nano-devel] set the terminal emulator's titlebar, Mike Frysinger, 2018/01/27
- Re: [Nano-devel] set the terminal emulator's titlebar, Benno Schulenberg, 2018/01/28
- Re: [Nano-devel] set the terminal emulator's titlebar, Mike Frysinger, 2018/01/29
- Re: [Nano-devel] set the terminal emulator's titlebar, Benno Schulenberg, 2018/01/29
- Re: [Nano-devel] set the terminal emulator's titlebar, Mike Frysinger, 2018/01/29
- Re: [Nano-devel] set the terminal emulator's titlebar, Benno Schulenberg, 2018/01/29
- Re: [Nano-devel] set the terminal emulator's titlebar, Mike Frysinger, 2018/01/29
- Re: [Nano-devel] set the terminal emulator's titlebar,
Benno Schulenberg <=