On Thu, Sep 28, 2006 at 11:58:58AM +0200, Wiseman wrote:
> I've noticed something curious: none of the terminals I tested send
> anything different for Ctrl+Enter, yet mc can tell, but only if you're
> not using it via SSH. Does mc read local scancodes if possible, or
> something similar? (If so, it'd be great to have some kind of mc
> --local that will use all keys properly in all cases when ran in the
> local terminal.)
As I understand it, when you use SSH, it's the SSH client/terminal
emulator that does the keyboard mapping. On a local console in Linux,
the mapping from scancodes to keys is done with the 'loadkeys' command.
If some of your keys don't work properly on a local terminal, you
probably need to change your loadkeys configuration. Someone correct me
if I am wrong about that.
Our future MC terminal tips file ought to say something about that. Like:
You may see someone talk about "pressing <Shift> plus the <F1> key".
That is misleading, What they really mean is "press the <F11> key",
but they assume that your keyboard uses <Shift>+<F1> to generate the
key sequence for <F11>. That isn't always true. On a modern PC
keyboard there are separate keys for <F11> and <F12>. Some keyboard
layouts use all 12 of those keys, and then start again with the
shifted versions. So pressing <Shift>+<F1> means <F13>, <Shift>+<F2>
means <F14>, and so on. In the MC editor, "Search" is <F7>, but
"Search Again" is <Shift>+<F5>. That is hard to remember, and it
was not what the MC creators intended.
Most Linux distributions come with the local console misconfigured
like that. It isn't a bug in MC, but an easy way to fix it is with
MC's 'Learn Keys' option. It won't let you reassign shifted F9 or
shifted F10, but you can assign F11 and F12 to F19 and F20. A better
solution would be to fix the Linux console. Read about the
'loadkeys' and 'dumpkeys' commands. On a remote terminal, you could
try to reconfigure your terminal emulator.
> I also noticed terminals (at least the ones I tried) use ^[ as Esc,
> and ^[xxx for all other non-printable keys. This has the very
> undesirable effect of making Esc a dead key (for which mc has a fix,
> but a delay of 1 second is far too much; I'd rather have 0 seconds).
> This also has the effect that Alt+<letter> is the same as Esc
> <letter>. Are there any terminals that will handle Esc differently, so
> that it becomes a real key you can just use normally?
I'm speculating here-- I'm not sure that is MC's doing. I suspect that
inserting an Escape character before a letter was the original function
of the Alt key. But I imagine some keyboards don't have an Alt key.
Instead, those users have to press <Esc>, then the letter. Setting the
delay to 0 seconds would make that impossible.
For others who might be confused by this conversation-- The ^ stands for
the <Ctrl> key. The unprintable control characters are produced by
pressing <Ctrl> plus a printable character. ^A is ASCII character
number 1, ^B is character 2, etc. ^[ produces character 27, the Escape
character. Most keyboards have some special keys for the commonly-used
control characters. The Tab key is the same as pressing ^I, Backspace
is ^H, Esc is ^[. On a local terminal, like DOS or even the Linux
console, an application can find out which key or key combination was
used to produce the character. On a remote terminal, it only knows what
the terminal tells it. If the terminal sends an Escape character, MC
has no way to know what key the user pressed to generate it.
Mc mailing list