GNOME Bugzilla – Bug 771367
'Sort Lines' distorts single line if the line is not fully selected.
Last modified: 2017-01-01 18:07: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.
Created attachment 335451 [details] [review] sourceview: Cleanup sort() gtk_source_buffer_sort_lines() does all of this for us!
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
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.
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().
Was this forgotten?
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.
Actually this all looks good upon testing.
(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 #?
Whoops, sorry this is the correct bug: https://bugzilla.gnome.org/show_bug.cgi?id=771373