Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some shortcuts not passed to application #1092

Closed
Vladimir-csp opened this issue Dec 28, 2023 · 9 comments
Closed

Some shortcuts not passed to application #1092

Vladimir-csp opened this issue Dec 28, 2023 · 9 comments

Comments

@Vladimir-csp
Copy link

Vladimir-csp commented Dec 28, 2023

Expected Behavior

mcedit should receive shift+pgup/pgdown, ctrl+shift+home/end like any other mods+directions shortcuts.

Current Behavior

It receives pgup/pgdown instead and ignores ctrl+shift+home/end

Possible Solution
Steps to Reproduce (for bugs)
  1. Run mcedit (editor from Midnight Commander)
  2. Try selecting text with shift+pgup/pgdown or ctrl+shift+home/end
Context

TERM: xterm-256color, emulation: default

System Information
  • QTerminal version: 1.4.0
  • Distribution & Version: Debian testing
  • Kernel: 6.5.0-5-amd64
  • Qt Version: 5.15.10
@Vladimir-csp
Copy link
Author

Also can not block select (terminal-side) in mcedit.

In other terminal emulators I could do it with ctrl+shift (ctrl for terminal block select, shift to bypass mcedit mouse handling).

Trided with ctrl+alt+shift, but that may be partially intercepted by compositor or something. Plain selecting with shift works, ctrl+shift does the same.

Can block select be remapped to ctrl instead of ctrl+alt?

@Vladimir-csp
Copy link
Author

Vladimir-csp commented Jan 5, 2024

...also paste on middleclick is successfully initiated even when shift is not pressed (usually mcedit blocks it, but it seems that it can not do that in qterminal). No, that is normal behavior.

@yan12125
Copy link
Member

Updating https://github.com/lxqt/qtermwidget/blob/master/lib/kb-layouts/default.keytab may fix them. Patches are welcom.

@Vladimir-csp
Copy link
Author

What exactly needs updating? Do I need to remove references to pgup/pgdown for applications to receive them (does not seem to work), or do I need to bind some tricky escape sequences to shift+pgup/pgdown, ctrl+shift+home/end?

@yan12125
Copy link
Member

Could you try appending this to /usr/share/qtermwidget5/kb-layouts/default.keytab?

key PgUp    +Shift+AppScreen : "some escape sequence"

The escape sequence can be checked in another terminal that works with mcedit. This is often tricky - here are some possible ways to find it:

  • Using strace to see what mcedit gets upon shortcuts
  • Run cat -v and hit shortcuts (the result may not be useful for mcedit as terminals can send different escape sequences to different applications)

Here I assume mcedit uses AppScreen mode, which is common for TUI applications. If not, you need to remove the following and append another line with the desired escape sequence

key PgUp    +Shift-AppScreen : scrollPageUp

@Vladimir-csp
Copy link
Author

only strace mcedit worked, in sakura:

# shift + pgup
read(4, "\33", 1)                       = 1
read(4, "[", 1)                         = 1
read(4, "5", 1)                         = 1
read(4, ";", 1)                         = 1
read(4, "2", 1)                         = 1
read(4, "~", 1)                         = 1

# shift + pgdown
read(4, "\33", 1)                       = 1
read(4, "[", 1)                         = 1
read(4, "6", 1)                         = 1
read(4, ";", 1)                         = 1
read(4, "2", 1)                         = 1
read(4, "~", 1)                         = 1

Added this, it works:

key PgUp    +Shift+AppScreen : "\E[5;2~"                                                                                                                                                                                                                   
key PgDown  +Shift+AppScreen : "\E[6;2~"  

ctrl+shift+home/end did not work even in sakura, maybe my memory just fails me. I wonder if it is possible to guess those sequences.

@yan12125
Copy link
Member

Cool! Feel free to open a pull request for working shortcuts.

I wonder if it is possible to guess those sequences.

Maybe try more terminals? Usually xterm supports escape sequences better, as most terminals follow escape sequences defined by xterm (that's what the environment variable TERM=xterm or TERM=xterm-256color means). If it doesn't work in xterm, I guess mcedit neees some changes.

@Vladimir-csp
Copy link
Author

lxqt/qtermwidget#530
It does not work in xterm )

@yan12125
Copy link
Member

Thanks! I merged the pull request for Shift+PgUp/PgDown. Issues with Ctrl+Shift+Home/End may not be caused by qterminal, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants