Mocp cleans playlist after execute external command and press left or right


Mocp cleans playlist after execute external command and press left || right.
Reproduce in Gentoo, Mint. I reproduced this bug in old version, in current version it's reproduce too.

$ mocp -V
This is : Music On Console
Version : 2.6-alpha1
Revision : Unversioned directory
Built : Jul 30 2015 15:13:31
Compiled with : ALSA Network streams resample
Running on : Linux 3.15.0-pf5 x86_64

How reproduce:
1. Insert to .moc/config line like this:

ExecCommand1 = "cp %f /var/tmp/"

2. Enter mocp
3. Press F1, Left, Left.
4. Playlist is clean now.

I didn't really understand the problem you see, but I thought it would become clear when I followed your recipe to reproduce it (thanks for that). However, it worked as expected for me.

Can you clarify for me what happens for you and what you're expecting should happen?

I confirm the issue, but the problem seems to happen for me only on terminal emulators under X and only with right arrow key. When I start MOC in text console I can't reproduce it. That's probably another of Ncurses weirdness.

To reiterate the problem for you: pressing F1 and right arrow several times causes playlist to clear. I didn't find anything suspicious in the log. However, that seems typical behaviour under terminal emulators. For example, in my IRSSI clone, pressing CTRL-RIGHT causes ";5C" text to appear. That would cause playlist clear command in MOC :)

Thanks for that clarification, tomaszg.

I don't have time right now to investigate any further myself, but I'd suggest that maybe a mismatch between what ncurses thinks is a cursor_right/KEY_RIGHT code and what the terminal emulator is sending might be to blame. Is there a termcap/terminfo entry which might be more appropriate to which you can set the TERM environment variable (and XTerms in the MOC configuration file)?

A possible work-around might be to remap clear_playlist to something other than "C" in your MOC keymap file, but that may just result in an error when the "C" of ";5C" actually does arrive.