[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xterm and mc shortcuts



On Wed, Jan 25, 2006 at 09:21:43AM +0200, Andras Lorincz wrote:
> 
> so /usr/share/terminfo/x/xterm is used in both cases. Regarding the stty -a
> output they are also the same. When pressing Ctrl-V the behaviour is the
> same: if I press once then nothing and if I press twice then ^V appears. If
> I press once Ctrl-V followed by Alt-c the same character appears.

What you _should_ get (for Meta-hotkeys to work in mc), is ^[c when you
press Ctrl-v Alt-c, for example.  Note that ^[ stands for ESC, i.e. the
terminal needs to generate the two-char sequence ESC c  (prefixing
Ctrl-v is just to have the next one key or escape sequence be printed
in human readable representation...).

Not sure I'm understanding you correctly, but I suppose you're seeing
nothing but the char c, but only when you type Ctrl-v Alt-c _as root_. 
As your regular user I'd expect you to see ^[c  Otherwise, mc would
most likely not work in this case either. [1]

Anyway, next thing to try is to explicitly set the xterm X resource
"metaSendsEscape", which is supposed to make xterm always issue the
above mentioned escape sequences (when the Meta modifier is held down)
instead of generating 8-bit characters (see xterm's manpage for details
and related info).  IOW, start xterm with the following command

# xterm -xrm XTerm*metaSendsEscape:true &

and see if it works then...  If it does, you're lucky [2].  If not, the
following information would help to narrow down on the problem:

* output of xmodmap
  (also, do you have any private ~/.xmodmaprc (or similar) ?) [3]

* output of xev, when hitting Alt key
  (in case Alt should generate keysym Alt_L, is there any other
  shift/modifier key which generates Meta_L?)

* "xrdb -query | grep -i xterm"
  (might be empty...)

* content of section "InputDevice" (for keyboard)
  in your XF86Config or xorg.conf

* locale setting / utf-8 enabled?

and of course

* "xterm -version"

* version of X (server and client libs)

* debian flavor

* anything else unusual... plus what I forgot to think of :)

Ideally, determine all of these both as root and as regular user, to be
able to tell apart a working from the malfunctioning setup  (Well, the
debian flavor most likely won't differ as root, but you get the idea..)

And, if you want to earn extra bonus points for being supportive in
solving the issue ;)  build xterm from source with debugging enabled,
i.e. use "configure --enable-trace".


> 
> I must mention that this behaviour is happening in mlterm too but not in
> konsole.

Different terminal, different code... can't say much more here, as I'm
not using those on a regular basis.  Seems mlterm's approach to the
"Meta key issue" is similar to that of xterm.  My personal favorite (in
particular for mc) is rxvt, or some derivative thereof.  Typically, it
just works, and if it once really should not, you simply tell it via a
commandline option what your Meta key is (plain and simple... less
magic that could go wrong).

Almut


[1] BTW, as a workaround, you can always spell out ESC c to emulate
Alt-c (i.e. hit ESC and c, one after the other)...  admittedly somewhat
more cumbersome to type, though -- except for those longterm vi users,
with their eleventh "ESC-key" finger :)

[2] what's left to be done then is to make that setting a more
permanent constituent of the effective X resources.  In case you're
not sure how to go about doing that, report back here -- or better yet,
search the list archives; this question comes up from time to time
(good keywords would probably be Xdefaults, Xresources, or some such).

[3] you could also try to play around with commands such as

xmodmap -e "keycode 64 = Meta_L" -e "clear mod1" -e "add mod1 = Meta_L"

(but be prepared to restart your X session, if you've messed up things
entirely, and can't work out any longer how to restore your original
key mappings...)



Reply to: