[Github-comments] [geany/geany] Indent of selected range and copy doesn't include indent of first line (#1693)

David C. Rankin notifications at xxxxx
Tue Nov 21 08:26:08 UTC 2017


This is more a feature request than a bug, so no immediate attention is required. The problem is selecting lines to indent and copy for pasting. If you full-select lines 1-10, and then choose indent, the existing selection does not include the new indent of the 1st line (meaning after indent, the selection bounds are never updated on line 1 to include the new spaces inserted before line one for the indent -- at least it behaves that way on windows) I have run into similar issues before and would propose a fix something like the following within the indent loop. Just a simple check if we are indenting the first line, and if so, move the start mark back to the beginning of the first line:

```
        /* reset start iter and start mark to beginning of line
         * so that selection continues to encompass entire first line.
         */
        if (start_line != end_line && i == start_line &&
            !gtk_text_iter_starts_line (&iter)) {
            gtk_text_iter_set_line_offset (&iter, 0);
            gtk_text_buffer_move_mark (buf, start_mark, &iter);
        }
```

then before return from the indent function just set the select range to encompass all indented lines:

```
    /* adjust selection to cover entire first line */
    gtk_text_buffer_select_range (buf, end, start);
```

I haven't checked whether geany is using indent features from scintilla or just a loop and custom indent function, so this may have to be wrapped around scintilla's indention.

A noted, this is just a feature request for tweaking the select range following indent so the whole newly indented range remains selected. Keep up the great work. Geany is by far the hands down favorite non-desktop integrated editor.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1693
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20171121/363010d3/attachment.html>


More information about the Github-comments mailing list