GNOME Bugzilla – Bug 342040
Query on what happens in terminal text area when you press backspace
Last modified: 2006-05-16 22:44:34 UTC
When I look at gnome-terminal via the AT-SPI, I'm noticing some curious behavior when I hit backspace while editing the command line. When I do this, the terminal seems to want to pad out the remainder of the line (i.e., from the caret to the right edge of the window) with spaces, issuing a text-inserted event for those spaces. In addition, when I press backspace, the text-deleted event is giving me incorrect information about what was deleted (it seems to tell me where the cursor ended up instead of what was deleted). Related to the backspace problem, if I press the space key before I've done the backspace, I get text-inserted events for the space. If I then press the space key after I've done the backspace, however, I don't get text-inserted events anymore; I just see caret-moved events. (I do see, of course, text-inserted events for other characters at this point, but not for spaces.) Ideally, this backspace padding would not happen and we would also get more reliable information when text is deleted. I've dug into the gnome-terminal code a little bit to try to find out where this is happening, but I've had little success. I'm curious if a gnome-terminal guru might be able to help or point me in the right direction. It would help me identify the source of the problem and I could then file more appropriate bugs.
Created attachment 65616 [details] Standalone test case to demonstrate the problem. To run this module, merely type 'python backspace.py' from an xterm. Then, fire up a gnome-terminal and type away, pressing backspace after you've started editing a line. The general gist is that you'll see that gnome-terminal spits out a text-inserted event for a block of spaces when you press backspace, and you'll also see no more text-inserted events are issued when you press space from that point on - only caret-moved events will be issued, presumably because gnome-terminal is just moving the caret across the padded spaces it made when you hit backspace.
*** This bug has been marked as a duplicate of 150858 ***