nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] set the terminal emulator's titlebar


From: Mike Frysinger
Subject: Re: [Nano-devel] set the terminal emulator's titlebar
Date: Mon, 29 Jan 2018 16:21:50 -0500

On 29 Jan 2018 20:57, Benno Schulenberg wrote:
> Op 29-01-18 om 17:48 schreef Mike Frysinger:
> > can you describe the issue in detail here ?  you're pressing ctrl+left 
> > arrow 
> > on a linux vt and it's not generating the sequences you expect ?
> 
> It's generating the expected keycode (we put ncurses into "keypad" mode,
> so it produces single-value keycodes instead of escape sequences), but
> this keycode is the same as for plain <Left>.  <Ctrl+Left>, <Shift+Left>
> and plain <Left> all produce the same keycode on a Linux console.  But
> there is a way to get at the state of the modifier keys (Shift, Ctrl,
> Alt): ioctl(0, TIOCLINUX) so I have used that.  It breaks down when
> keystrokes get queued, or when ssh'ing to another machine, but for
> typical use on a local VT, it works fine.

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.  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.

> <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.  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:

<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

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.
-mike

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]