Hi Mattias: I tried the patch and it seems to reduce notably the issue. There is still a small distance between the cursor arrow and the point (the arrow stays over the rectangle's last position and the point is just after it). But at least now the distance is small and remains more or less constant. Is it possible to keep the mouse and the point in the same position without breaking too many things? (like when selecting without the C-M) There are 3 pictures attached: Square selection forward, backward and normal selection. Just to show the difference. On Sat, Nov 30, 2019 at 12:08:47PM +0100, Mattias Engdeg�rd wrote: >29 nov. 2019 kl. 15.39 skrev Ergus : > >> YES!!! this seems to work now. :) > >Perhaps the workaround should be mentioned in the docs for xterm-mouse-mode? > >> So the only issue now is what I reported on yesterday about the distance >> between rectangle border (point) and pointer in white spaces (or empty >> lines). But it seems to be related with display-line-numbers-mode. > >That's clearly wrong, thanks for spotting it. There were problems with side-by-side windows as well. In addition, the mouse tracking was sometimes one cell off. > >Please try the attached patch. > >I couldn't make up my mind whether to have the mouse track the cursor or the rectangle corner. Tracking the cursor mirrors the behaviour of plain (linear) text selection, but corner tracking works better up to the right margin. > >You can set mouse--rectangle-track-cursor to select either behaviour; I'm not sure if it should be a defcustom, or what the default should be. Right now it's nil (tracks the corner). >