GNOME Bugzilla – Bug 755187
Reported mouse coordinate is off if scrolled back
Last modified: 2015-10-03 19:29:44 UTC
Produce some output (more than a screenful). Start an app that handles mouse, but does not switch to alternate screen. One possibility is "vim some_existing_file" with this .vimrc: set mouse=a set ttym=xterm set t_ti= t_te= Scroll back by a few lines using Ctrl+Shift+Up. Click somewhere. Notice that the cursor is not moved to the location where you clicked. The mouse escape sequence that vte sends is computed from the coordinates of the pointer within the widget; ignoring scroll_delta. xterm, urxvt and putty first scroll the scrollbar to the very bottom so that this problem can't arise at all. iTerm2 takes scroll_delta into account, and if you click inside the scrollback area (rather than on the area occupied by vim) then it does what it'd do if mouse mode wasn't enabled. konsole also takes scroll_delta into account, and does nothing if you click outside of vim's area.
IMO iterm and konsole have it right here. We do have the 'scroll to bottom on keystroke' pref, so certainly could add a 'scroll to bottom on mouse event if in mouse tracking mode' pref too, but I don't think it's necessary.
Quick fix submitted as ac3438c. Will be reworked for smooth scrolling anyways. Do nothing if the click occurs outside of the normal area. This wasy the simplest solution. I really don't want to have any prefs for this, it's such a rare corner case.