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

Esc-p and Esc-n don't work in External Panelize command history, only Esc-h works #3772

Open
mc-butler opened this issue Feb 14, 2017 · 7 comments
Labels
area: core Issues not related to a specific subsystem prio: medium Has the potential to affect progress

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/3772
Reporter cri (cri@….org)

In the "External panelize" popup window, when I select the lower "Command" field, the only way to navigate the commands history is to use Esc-h. One would expect that Esc-p and Esc-n could be used to see the previous/next command (like in the main panels), but this results in exiting the "External panelize" window instead.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Feb 15, 2017 at 1:57 UTC (comment 1)

I can't reproduce this. Esc-p/n work for me.

@mc-butler
Copy link
Author

Changed by cri (cri@….org) on Feb 15, 2017 at 21:40 UTC (comment 2)

Well, I can't reproduce it either :) when I run LANG=C mc

I can reproduce it when I use mc with locales different from C (I tried a handful of European UTF-8 locales, so it's not just one particular locale).

i18n bug?

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Feb 15, 2017 at 23:48 UTC (comment 3)

I still can't reproduce this. I tried with he_IL.utf8 and en_DK.utf8.

Do you encounter the problem when you're using an English locale (i.e., en_US)?

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Feb 16, 2017 at 6:17 UTC (comment 4)

Can you specify which particular locale is that? Are we only talking only about a locale or also keyboard layout? For instance, the shortcuts aren't working (by design) with Cyrillic keyboard layout, but I hope you've figured that much... ;-)

@mc-butler
Copy link
Author

Changed by cri (cri@….org) on Feb 16, 2017 at 9:52 UTC (comment 5)

Ok, I did more testing: some locales work, some don't.

The failing locales use "p" and/or "n" as a shortcut keys for the commands in the bottom line of the window "[Panelize] [Remove] ...etc"

So mc is interpreting Esc-p as if "p" was actually pressed, and executes the corresponding shortcut, which in some localisations is used for the "Panelize" command.

Using Alt-p or Alt-n instead of Esc does not work, I get strange characters (ð î) printed instead (I'm running mc in xterm)

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Feb 16, 2017 at 11:28 UTC (comment 6)

Well, you can see this "bug" in the "Editor options" dialog as well (go to the editor and in the menu choose: Options >> General); here's how:

Move the focus to the "Tab spacing" WInput. Press Alt-p or Alt-n (to move in the history) and you'll instead trigger either the "Save file &position" checkbox or the "&None" radio.

This is not really a bug: hotkeys (labels of buttons/checkboxes/radios) are handled before normal keybindings (keymaps, like Alt-n/p). I don't see a solution that'd be simple enough to worth the bother.

Looking at src/keybind-defaults.c I see the folloxing alt-X bindings for WInput:

{"WordLeft", "ctrl-left; alt-b"},
{"WordRight", "ctrl-right; alt-f"},
{"DeleteToWordEnd", "alt-d"},
{"Store", "alt-w"},
{"History", "alt-h"},
{"HistoryPrev", "alt-p; ctrl-down"},
{"HistoryNext", "alt-n; ctrl-up"},

So the problem is going to be with alt-{b,f,d,w,h,p,n}: labels using these 7 letters as hotkeys are going to steal them from the WInput.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Feb 16, 2017 at 12:14 UTC (comment 5.7)

I don't see a solution [in code] that'd be simple enough to worth the bother.


So the solution is to "fix" the localized strings (tip: do grep -A1 'msgid "Pane&lize"' *.po | grep -C1 -i -P '&(p|n)' to find the problematic localizations). But note that "Pane&lize" is also used on the "Find file" dialog so you'd want to make sure the hotkey you pick isn't shared with the rest of the buttons there.

Replying to cri:

Using Alt-p or Alt-n instead of Esc does not work


It wouldn't make a difference.

I get strange characters (ð î) printed instead (I'm running mc in xterm)


(Press ctrl + left mouse button, and in the menu turn on "Meta Sends Escape".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues not related to a specific subsystem prio: medium Has the potential to affect progress
Development

No branches or pull requests

1 participant