After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722635 - selection is moved on a different part of the text when vte widget is resized
selection is moved on a different part of the text when vte widget is resized
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: vte-0-36
Assigned To: VTE Maintainers
VTE Maintainers
[fixed-0-36][needed-next][commit:9ff5...
Depends on:
Blocks:
 
 
Reported: 2014-01-20 18:29 UTC by Baptiste Mille-Mathias
Modified: 2014-04-06 18:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screencast of the problem (1.30 MB, video/webm)
2014-01-20 18:29 UTC, Baptiste Mille-Mathias
  Details
Fix: update selection on rewrap (1.06 KB, patch)
2014-01-20 19:27 UTC, Egmont Koblinger
none Details | Review
Fix: update selection on rewrap (v2) (1.09 KB, patch)
2014-01-20 19:37 UTC, Egmont Koblinger
none Details | Review
Fix: update selection on rewrap (v3) (3.01 KB, patch)
2014-01-20 20:59 UTC, Egmont Koblinger
committed Details | Review

Description Baptiste Mille-Mathias 2014-01-20 18:29:29 UTC
Created attachment 266787 [details]
Screencast of the problem

Select a text
resize the terminal window
observe the selection is no more on the selected text, eventually find the selection moved to another part of the text.
(see the screencast attached)

I guess this is a regression with the reflow functionnality that lend into vte recently.
Comment 1 Egmont Koblinger 2014-01-20 19:27:36 UTC
Created attachment 266797 [details] [review]
Fix: update selection on rewrap

Indeed, it didn't occur to me to update the selection. Nice catch, thanks very much! :)

Could you please test the attached patch? I believe it fixes the problem.
Comment 2 Egmont Koblinger 2014-01-20 19:37:05 UTC
Created attachment 266799 [details] [review]
Fix: update selection on rewrap (v2)
Comment 3 Egmont Koblinger 2014-01-20 19:43:40 UTC
Hmmm, not good if the selection ends with a complete line (highlighing all the way to the right margin).
Comment 4 Egmont Koblinger 2014-01-20 20:26:20 UTC
There are two problems with highlights finishing with a complete line:

- selection_end is inclusive (the last char belonging to the selection) rather than exclusive which would sound more logical to me. Changing the semantics all over the code seems a bit risky; probably incrementing before rewrap and decrementing after is an easy workaround.

- there's a confusion that a selection finishing with a complete line might be stored in two different ways. If you move the mouse to the right, it will be stored as (row = that row, col = terminal's width), but if you move the mouse to the left then it's stored as (row = the next row, col = -1). I'm yet to understand if it makes sense to maintain both possibilities, or if there's any difference between the two. It would simplify my life a lot if I could just go with the (row = next row, col = -1) way of storing.
Comment 5 Egmont Koblinger 2014-01-20 20:59:28 UTC
Created attachment 266805 [details] [review]
Fix: update selection on rewrap (v3)

I hope it really works okay and I didn't break anything :)
Comment 6 Egmont Koblinger 2014-01-24 00:04:10 UTC
Fixed in vte-0-36. Keeping open for vte-next.
Comment 7 Egmont Koblinger 2014-01-24 00:19:51 UTC
Oops, not fixed yet. selection_end.col can be less than -1 and then it breaks. Probably selection_start.col can also be less than -1.
Comment 8 Egmont Koblinger 2014-01-24 00:36:18 UTC
Okay, this one's fixed too. (Only in vte-0-36.)
Comment 9 Egmont Koblinger 2014-02-12 21:17:09 UTC
One more bug:
The start coordinate was not confined to be inside the visible area (as it
is done in from vte_terminal_extend_selection() for the end point).

Fixed now in vte-0-36.