GNOME Bugzilla – Bug 785736
textview: fix bug on DnD displaced limits of selection
Last modified: 2017-08-29 18:28:07 UTC
Reproduce: 1. Configure textview to show line numbers on the left side of textview. 2. Select some text 3. Drag it (don't drop it) 4. Move it horizontally along the start (or end) of the selected text. What should happen? DnD icon should change from "not allowed to drop" to "permitted drop" when you move after the end iter of the selection or before the start iter of the selection. What actually happens? This limit is displaced by the width that the 'line numbers' (on the left of the textview) takes.
Created attachment 356783 [details] [review] textview: fix bug on DnD displaced limits of selection textview: fix bug on DnD displaced limits of selection The fix of commit f2fd655754407103f8fb9b2c3e7586fb595ab917 should be confined to DnD coords only, because otherwise it causes the start and enf of the selection to be displaced.
CC'ing Carlos as per commit f2fd655754407103f8fb9b2c3e7586fb595ab917
Review of attachment 356783 [details] [review]: I'm not an authority, but fwiw this makes sense to me, so I see no problem if you've confirmed that it fixes the issue and doesn't cause any others. albeit with style nitpicking as always :) First, s/enf/end/ in the commit message. Secondly, it would be nice to paste the whole bug URL instead of "Fixes bug NN"; that's the convention, at least. ::: gtk/gtktextview.c @@ +9602,3 @@ + priv->dnd_x = x - target_rect.x; /* DnD uses text window coords, so substract extra widget */ + priv->dnd_y = y - target_rect.y; /* coords that happen eg. when displaying line numbers. */ I would say to instead have a single comment block above these 2 lines of code, rather than splitting the comment across them. This will also keep the line lengths down. A multi-line comment in GTK+ style will look like this: /* the first line * the last line */ nits: s/substract/subtract and s/eg./e.g./
Created attachment 357486 [details] [review] textview: fix bug on DnD displaced limits of selection Updated patch with spotted style changes. Thanks Daniel for review.
Can I be a pain and ask for a minimal test case? People online seem to find > 1. Configure textview to show line numbers on the left side of textview. a lot more complicated than you do. :) And, e.g. GEdit already behaves fine here.
(In reply to Daniel Boles from comment #5) > Can I be a pain and ask for a minimal test case? People online seem to find > > > 1. Configure textview to show line numbers on the left side of textview. > > a lot more complicated than you do. :) And, e.g. GEdit already behaves fine > here. It's easy, just tick the following preference: Gedit -> Preferences -> View -> Display line numbers Or you can reproduce it on gnome-builder which already displays line numbers by default.
Right, I had already tried GEdit as mentioned, but I misunderstood your steps, so I was checking the wrong thing. I can replicate it now. Will test the patch too. Seems like it's a no-brainer if it works.
Review of attachment 357486 [details] [review]: Makes sense, fixes it for me, and doesn't even conflict with the oddity of using Container:border-width as fixed by recent patches.
Thanks for the report and patch! Attachment 357486 [details] pushed as 0732020 - textview: fix bug on DnD displaced limits of selection