TERM environment variable

MOC version: 

I noticed that when setting the current directory with the "go to a directory" command, the backspace key does not work in the path input field. This seems to be related to the use of tmux, which i'm always using, and more precisely it is the environment variable "TERM", which is set to "screen" by tmux. If I run mocp with TERM=xterm which is the default value in xfce Terminal then backspace works in mocp. As everywhere else backspace works AFAIK in tmux, there might be something related to mocp for this problem.

It seems very likely that the TERM setting is a factor here. Fortunately, I'm fresh from having solved a similar problem so know where to look.

Just to help me, could you please try using the 'Backspace' key, the 'Delete' key, the keypad 'Del' key and the shifted keypad 'Del' key (assuming your keyboard has all of those) and report the results when using a TERM setting of both 'linux' and 'screen'.

You might find it easier to do that by e-mail.

I don't have any keypad, even the one that takes over part of the right hand keys of the keyboard. It seems manufacturers have stopped this option. For your question, the 'Del' key is working in both cases of TERM value, i.e. xterm and tmux.

Previously i tried with manually setting TERM=xterm in tmux and noticed backspace was working in mocp. Now i tried with manually setting TERM=screen without using tmux and i noticed backspace is not working in mocp. This confirms the problem is related to the TERM environment variable only.

According to this ncurses document, the screen terminfo entry is specific to GNU Screen (although obviously its use is not restricted to it) and it has a number of deficiencies. One of those deficiencies seems to be a lack of backspace key support.

I checked the screen terminfo entry on my system and it did not have a capability for the backspace key (kbs). However, I was only able to reproduce your problem on my system by disabling a long-standing backspace correction in the MOC code. I am relucant to add this as a second correction in MOC as doing so runs the risk of misinterpreting that keycode if presented for a different keypress on other systems.

I think it would be better if you are able to configure tmux to set the TERM environment variable to either linux or screen.linux (both of which work on my system).

So in summary, the problem lies with the screen terminfo entry rather than MOC.

Just a thought, but do you have screen installed? Because setting TERM to screen when there isn't any terminfo or termcap is probably going to have weird results.

Sidenote: I found that setting TERM to xterm-color has better results with some programs.