Ticket #3772 (new defect)

Opened 8 years ago

Last modified 8 years ago

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

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

Description

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.

Change History

comment:1 Changed 8 years ago by mooffie

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

comment:2 Changed 8 years ago by cri

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?

comment:3 Changed 8 years ago by mooffie

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)?

comment:4 Changed 8 years ago by zaytsev

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

comment:5 follow-up: ↓ 7 Changed 8 years ago by cri

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)

comment:6 Changed 8 years ago by mooffie

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.

comment:7 in reply to: ↑ 5 Changed 8 years ago by mooffie

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

Note: See TracTickets for help on using tickets.