Ticket #4512 (new enhancement)

Opened 5 months ago

Last modified 5 months ago

mc should use kPRV5 from terminfo for Ctrl+PageUp

Reported by: CyberShadow Owned by:
Priority: major Milestone: Future Releases
Component: mc-tty Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

I noticed that the Ctrl+PageUp? combination (to navigate to the parent directory) didn't work in wezterm (with config.term = "wezterm"). A bit of experimentation showed that it worked when wezterm identified itself as xterm, or if mc is started with --xterm. Upon investigating, I found that the reason why it works with TERM=xterm is only because mc itself hard-codes the sequence that xterm uses (the xterm_key_defines array), when it detects that it is running in that terminal emulator (check in init_key) or with --xterm.

I am not sure if this is standardized anywhere, but I noticed that many terminal emulators declare the sequence for Ctrl+PageUp? as the kPRV5 capability in their terminfo. Grepping for kPRV5 in my /usr/share/terminfo gives me over 60 matches. wezterm's terminfo doesn't have it yet, but it would not be a problem to add it.

I think it would be nice if mc checked terminfo for capability strings such as kPRV5, in order to support such key combinations in other terminals.

I can work on a patch with some guidance. I noticed the Key_xxx definitions in keyxdef.c, but it's not clear to me how to extend that to only teach mc about some new terminfo keys.

Change History

comment:1 Changed 5 months ago by andrew_b

  • Component changed from mc-core to mc-tty

Terminal-specific sequences can be defined in mc.lib.

comment:2 Changed 5 months ago by CyberShadow

Ah, thanks for that pointer! That does provide a simple workaround, and I guess the keys could just be added there in the default version of the file.

Though, that would still duplicate the information in terminfo, for terminals which do have it in terminfo. What about getting this information from terminfo, if it is there - is that feasible?

comment:3 Changed 5 months ago by andrew_b

It would be nice.

Note: See TracTickets for help on using tickets.