Ticket #4149 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

TERM=alacritty, TERM=tmux and TERM=tmux-256color don't handle Shift+F<N>.

Reported by: slyfox Owned by: andrew_b
Priority: major Milestone: 4.8.26
Component: mc-tty Version: 4.8.25
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

alacritty (https://github.com/alacritty/alacritty) is an xterm-compatible terminal. Note how small the diff is (no diffs around kf* entries):

$ infocmp -a1 xterm alacritty
comparing xterm to alacritty.
    comparing booleans.
        ccc: F:T.
        hs: F:T.
        km: T:F.
    comparing numbers.
        colors: 8, 256.
        pairs: 64, 65536.
    comparing strings.
        dsl: NULL, '\E]2;\007'.
        fsl: NULL, '^G'.
        initc: NULL, '\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\'.
        ka1: '\EOw', NULL.
        ka3: '\EOy', NULL.
        kb2: '\EOu', '\EOE'.
        kbs: '^H', '^?'.
        kc1: '\EOq', NULL.
        kc3: '\EOs', NULL.
        mgc: '\E[?69l', NULL.
        oc: NULL, '\E]104\007'.
        rs1: '\Ec', '\Ec\E]104\007'.
        setab: '\E[4%p1%dm', '\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m'.
        setaf: '\E[3%p1%dm', '\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m'.
        setb: '\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m', NULL.
        setf: '\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m', NULL.
        smglr: '\E[?69h\E[%i%p1%d;%p2%ds', NULL.
        tsl: NULL, '\E]2;'.
        Se: '\E[2 q', '\E[0 q'.
        TS: NULL, '\E]2;'.
        ka2: '\EOx', NULL.
        kb1: '\EOt', NULL.
        kb3: '\EOv', NULL.
        kc2: '\EOr', NULL.
        kp5: '\EOE', NULL.
        kpADD: '\EOk', NULL.
        kpCMA: '\EOl', NULL.
        kpDIV: '\EOo', NULL.
        kpDOT: '\EOn', NULL.
        kpMUL: '\EOj', NULL.
        kpSUB: '\EOm', NULL.
        kpZRO: '\EOp', NULL.

tmux is a screen-compatible wrapper. infocmp -a1 screen-256color tmux-256color is a bit bigger. I'll omit it.

All of the melow fails on ncurses-6.2:

# in alacritty
$ TERM=alacritty mc
< press Shift-F6 to rename a directory>
< got: F8 response >

# in tmux in xterm
$ TERM=tmux mc
< press Shift-F6 to rename a directory>
< got: F8 response >

# in tmux in xterm
$ TERM=tmux-256color mc
< press Shift-F6 to rename a directory>
< got: F8 response >

I think xterm and screen only work because mc hardcodes terminal names in misc/mc.lib:

...
[terminal:xterm]
...
f16=\\e[29~;\\e[17\;2~
...

[terminal:gnome]
copy=xterm

[terminal:rxvt]
copy=xterm

[terminal:xterm-new]
copy=xterm

[terminal:xterm-color]
copy=xterm

[terminal:xterm-256color]
copy=xterm

[terminal:screen]
copy=xterm

[terminal:screen-256color]
copy=xterm
...

We can hardcode a few more $TERM names, but it does not scale very well and is not compatible to user-defined terminal definitions if they chose to do it.

WDYT of making feature detection based only on terminfo capabilities if those are sufficient?

$ LANGUAGE=en mc --version
GNU Midnight Commander 4.8.25
Built with GLib 2.64.5
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor and Aspell support
With subshell support as default
With support for background operations
With mouse support on xterm
With support for X11 events
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:
 cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish, smbfs
Data types:
 char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

Attachments

0001-Ticket-4149-add-alacritty-tmux-tmux-256color-as-xter.patch (1001 bytes) - added by slyfox 4 years ago.
0001-Ticket-4149-add-alacritty-tmux-tmux-256color-as-xter.patch

Change History

comment:1 in reply to: ↑ description Changed 4 years ago by andrew_b

  • Component changed from mc-core to mc-tty

Replying to slyfox:

WDYT of making feature detection based only on terminfo capabilities if those are sufficient?

There is a risk to broke the mc tty layer. Personally I'm not ready to do that.

comment:2 Changed 4 years ago by andrew_b

Related tickets: #1769, #1890, #3254.

Changed 4 years ago by slyfox

0001-Ticket-4149-add-alacritty-tmux-tmux-256color-as-xter.patch

comment:3 Changed 4 years ago by slyfox

0001-Ticket-4149-add-alacritty-tmux-tmux-256color-as-xter.patch adds alacritty, tmux, and tmux-256color as aliases of xterm.

comment:4 follow-up: ↓ 5 Changed 4 years ago by ossi

There is a risk to break the mc tty layer. Personally I'm not ready to do that.

nah, some minor temporary regressions seem like a perfectly acceptable price to pay for that.

Last edited 4 years ago by andrew_b (previous) (diff)

comment:5 in reply to: ↑ 4 Changed 4 years ago by andrew_b

Replying to ossi:

There is a risk to broke the mc tty layer. Personally I'm not ready to do that.

nah, some minor temporary regressions seem like a perfectly acceptable price to pay for that.

Patches are welcome!

Version 0, edited 4 years ago by andrew_b (next)

comment:6 Changed 4 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.26

comment:7 Changed 4 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:8 Changed 4 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:9 Changed 4 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.