reset
is vast overkill. For starters, simply re-starting and then properly exiting the application will fix this. It after all turns off the mouse reports that it has asked for at exit.
Alternatively, you just yourself send to the terminal the control sequences that turn the mouse reports back off. You can do this with the printf
shell utility, entering the control sequences by hand using the escape notation.
For convenience, and for user-space virtual terminals, I created an improved portable version of the setterm
utility that can do this. It works with GUI terminal emulators and the BSDs, unlike the util-linux one; and it is sensitive to the fact that only some terminal families properly handle the control sequences:
% printenv TERM
dumb
% setterm -7 --xterm-mouse-reports off --dec-locator-reports off
% setterm -7 --xterm-mouse-reports off --dec-locator-reports off | console-decode-ecma48
% setterm -7 --xterm-mouse-reports off --dec-locator-reports off | hexdump -C
% export TERM=xterm-256color
% export XTERM_VERSION=999
% setterm -7 --xterm-mouse-reports off --dec-locator-reports off | console-decode-ecma48
DECELR 0
DECSLE 0
DECRM 1006
DECRM 1003
DECRM 1002
DECRM 1000
% setterm -7 --xterm-mouse-reports off --dec-locator-reports off | hexdump -C
00000000 1b 5b 30 27 7a 1b 5b 30 27 7b 1b 5b 3f 31 30 30 |.[0'z.[0'{.[?100|
00000010 36 6c 1b 5b 3f 31 30 30 33 6c 1b 5b 3f 31 30 30 |6l.[?1003l.[?100|
00000020 32 6c 1b 5b 3f 31 30 30 30 6c |2l.[?1000l|
0000002a
%
There are the control sequences.
Further reading
reset
command. – egmont Feb 19 '20 at 08:27