I use Midnight Commander 4.8.16.
If I set xterm 256 colors: export TERM=screen-256color
then my mouse does not work, but forcing xterm: mc -x
resolves the issue.
How to permanently force xterm (in mc config w/o using alias)?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityUsing TERM=screen-256color
seems to be the problem. In the source code (tty_check_term
), Midnight Commander treats that as "xterm" (and decides it supports a mouse) only if DISPLAY
also is set. Ignore the comment (it is wrong), and just read the source code. The function return value is used in one place, from main.c
(again, ignore the comment...).
Midnight Commander ignores the actual contents of the terminal description, which happens to say that this configuration supports xterm-style mouse (i.e., the existence of kmous=\E[M,
in the description). It does this to work around its problems using slang, which also ignores the terminal description, looking only at TERM
. This is an old bug, dating back to the 1990s.
As a workaround, you could set DISPLAY
to a dummy value if it is unset, since Midnight Commander does nothing more with it than this check. Depending on your environment, that may have other side effects.
Further reading:
Be careful assigning the
kmous
capability. The ncurses wants to interpret it asKEY_MOUSE
, for use by terminals and emulators like xterm that can return mouse-tracking information in the keyboard-input stream.
export DISPLAY=_
works like a charm. And should I tell you what am I using? - mintty
in Windows 10 Subsystem for Linux (Ubuntu 14.04 currently), and everything seem to work fine :)