Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

From time to time my KDE Konsole goes crazy, every time I click in it with the mouse it print out garbage characters :) It's not really annoying, I just close it, but I'm curious why this happens.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Let me guess: do you mean the effect that you get when you execute the following command?

printf '\e[?1000h'

What happens is the following. There are two kinds of programs running in a terminal emulator like konsole: those that rely on the basic mouse handling offered by the terminal program (e.g.: left button selects, middle button pastes), and those that want to do their own interpretation of mouse events. Most programs, such as bash, do the former, midnight commander (mc) is an example of the latter. If a program wants to interpret mouse events by itself, it sends a certain "escape sequence" (like the one above) to konsole, so that konsole sends back the coordinates of the mouse whenever a button is pressed; when the program stops, it sends another "escape sequence" to konsole, so that konsole returns to its normal mode.

What happened in your case is that konsole received the escape sequence without a cooperating program running. There are several possible reasons:

  • A badly programmed tool switched the mouse mode and then crashed without switching back.

  • You dumped some binary data, e.g., some executable program to the screen, which contained the mouse switching escape sequence.

  • You misspelled some escape sequence, that was supposed to, e.g., change the font or the background colour in your prompt and accidentally got the mouse switching escape sequence.

The same applies to other terminal emulator programs like xterm or gnome-terminal. (The mouse switching escape sequence was introduced in xterm; both konsole and gnome-terminal copied it.) By the way, it's usually not necessary to close konsole if something like this happens. You can use the reset command to return to the normal mode.

share|improve this answer
    
Yes, exactly this :) Excellent answer! –  fritzone Apr 22 '13 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.