>From c0b451f240c3d8e7ee4b84202404a8ad63efa1e8 Mon Sep 17 00:00:00 2001 From: Brand Huntsman Date: Fri, 8 Dec 2017 21:17:53 -0700 Subject: [PATCH 2/2] add first indentation or comment sequence to selection Signed-off-by: Brand Huntsman --- src/text.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/text.c b/src/text.c index b0ac980b..af3e3b21 100644 --- a/src/text.c +++ b/src/text.c @@ -343,6 +343,14 @@ void do_indent(void) free(indentation); + /* Add the first indentation to selection if top cursor is at start of line */ + if (openfile->mark && top_x == 0) { + if (openfile->mark->lineno <= openfile->current->lineno) + openfile->mark_x = 0; + else + openfile->current_x = 0; + } + set_modified(); refresh_needed = TRUE; shift_held = TRUE; @@ -552,6 +560,14 @@ void do_comment(void) update_multiline_undo(line->lineno, ""); } + /* Add the first comment sequence to selection if top cursor is at start of line */ + if (openfile->mark && top_x == 0 && action == COMMENT) { + if (openfile->mark->lineno <= openfile->current->lineno) + openfile->mark_x = 0; + else + openfile->current_x = 0; + } + set_modified(); refresh_needed = TRUE; shift_held = TRUE; -- 2.13.6