Those are xterm-style "mouse" events. You could in principle turn off those using a suitable printf
or echo
, but reset
does it already as part of the rs1
or rs2
string in the terminal description (see output of "infocmp").
reset
uses this for instance:
rs1=\Ec,
rs2=\E[!p\E[?3;4l\E[4l\E>,
and prefers the latter (the former is a hard-reset). The \E
is the escape character. Offhand, that first chunk in rs2
, \E\[!p
is a soft-reset, which generally resets the mouse along with most other useful things. A printf would be
printf '\033[!p'
which is more typing than
reset
(even if you use some non-standard echo
which knows about \E
). But that comment about arrow keys: the soft reset puts the cursor-keys back in normal mode, while vi thinks they're in application mode.
To disable only the mouse, take a look at the output of infocmp -x
:
XM=\E[?1006;1000%?%p1%{1}%=%th%el%;,
That tells ncurses how to enable/disable the mouse. Your terminal description isn't exactly that, but the 1000
is the normal mouse mode that your example shows. So... you could do this
printf '\033[?1000l'
(lowercase L disables), and kill just the mouse.
You're seeing those because "some program" doesn't clean up after itself.