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 771367 - 'Sort Lines' distorts single line if the line is not fully selected.
'Sort Lines' distorts single line if the line is not fully selected.
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
3.21.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-13 15:25 UTC by Mohammed Sadiq
Modified: 2017-01-01 18:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sourceview: Cleanup sort() (2.02 KB, patch)
2016-09-13 16:45 UTC, Garrett Regier
committed Details | Review

Description Mohammed Sadiq 2016-09-13 15:25:13 UTC
How to reproduce:

1. Select any one line partially.
2. Right click -> Selection -> Sort line.

Result:
The line content is distorted.

Expected result:
No change should be made, as sorting can't be done with just one line.
Comment 1 Garrett Regier 2016-09-13 16:45:05 UTC
Created attachment 335451 [details] [review]
sourceview: Cleanup sort()

gtk_source_buffer_sort_lines() does all of this for us!
Comment 2 Garrett Regier 2016-09-13 16:45:39 UTC
The rest (bulk) of this bug needs to be fixed in GtkSourceView, filed a bug+patch:
https://bugzilla.gnome.org/show_bug.cgi?id=771368
Comment 3 Christian Hergert 2016-09-13 16:52:20 UTC
Review of attachment 335451 [details] [review]:

LGTM, but I do want to ensure that we are left on the first line of non-empty text after the sort.
Comment 4 Garrett Regier 2016-09-13 16:54:38 UTC
That should already be done, GSV calls _gtk_source_buffer_save_and_clear_selection() before gtk_text_buffer_delete() and then _gtk_source_buffer_restore_selection().
Comment 5 Michael Catanzaro 2016-12-31 18:46:36 UTC
Was this forgotten?
Comment 6 Christian Hergert 2016-12-31 20:41:04 UTC
I did in fact forget about it, but I would still like to see a follow up commit that moves the cursor to the first non-space character of the first line of the selected range.
Comment 7 Christian Hergert 2017-01-01 00:09:16 UTC
Actually this all looks good upon testing.
Comment 8 Daniel Boles 2017-01-01 07:12:12 UTC
(In reply to Garrett Regier from comment #2)
> The rest (bulk) of this bug needs to be fixed in GtkSourceView, filed a
> bug+patch:
> https://bugzilla.gnome.org/show_bug.cgi?id=771368

That seems to be a different ticket. Could you post the real ticket #?
Comment 9 Garrett Regier 2017-01-01 18:07:13 UTC
Whoops, sorry this is the correct bug:
https://bugzilla.gnome.org/show_bug.cgi?id=771373