From efa323ec88818df9f09677c1007841571a84540b Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 25 Sep 2018 20:25:21 +0200 Subject: [PATCH] tweaks: improve two comments, and reshuffle a line for consistency (Line number first, x position second.) --- src/text.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/text.c b/src/text.c index b3e36173..9c5d0b8b 100644 --- a/src/text.c +++ b/src/text.c @@ -1319,7 +1319,8 @@ void add_undo(undo_type action) undo *u = openfile->current_undo; /* The thing we did previously. */ - /* When doing contiguous adds or cuts, don't add a new undo item. */ + /* When doing contiguous adds or cuts, don't add a new undo item, but + * let a later update call update the existing item. */ if (u != NULL && action == openfile->last_action && action == u->type && openfile->current->lineno == u->mark_begin_lineno && ((action == ADD && u->mark_begin_x == openfile->current_x) || @@ -1480,7 +1481,8 @@ void update_multiline_undo(ssize_t lineno, char *indentation) u->newsize = openfile->totsize; } -/* Update an undo record, after checking that a new one is not needed. */ +/* Update an undo item with (among other things) the file size and + * cursor position after the given action. */ void update_undo(undo_type action) { undo *u = openfile->undotop; @@ -1527,8 +1529,8 @@ void update_undo(undo_type action) break; case REPLACE: case PASTE: - u->begin = openfile->current_x; u->lineno = openfile->current->lineno; + u->begin = openfile->current_x; break; #ifdef ENABLE_WRAPPING case SPLIT_BEGIN: