commit e31d59ebc89b209d183a9fb4aa5bec27f5ce61d3
parent 11178e14abc45e60469f764b6e682fce8d77b8bc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 17 Aug 2022 08:50:38 +0200
tweaks: move two checks plus corresponding calls to a better place
It was silly to check again specifically for <Del> and <Bsp> after
any possible keystroke had been handled. It was an anomaly.
This makes the tail of do_deletion() similar to the tail of inject().
(That sometimes the current line is redrawn twice is acceptable -- how
often does one type <Backspace> while having Shift-selected something?
Normally one wouldn't, because it would cancel the selection, so it's
fine to accept some inefficiency for this case.)
Diffstat:
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/cut.c b/src/cut.c
@@ -97,6 +97,13 @@ void do_deletion(undo_type action)
/* We're at the end-of-file: nothing to do. */
return;
+#ifdef ENABLE_COLOR
+ if (!refresh_needed)
+ check_the_multis(openfile->current);
+#endif
+ if (!refresh_needed)
+ update_line(openfile->current, openfile->current_x);
+
/* Adjust the file size, and remember it for a possible redo. */
openfile->totsize--;
#ifndef NANO_TINY
diff --git a/src/nano.c b/src/nano.c
@@ -1665,17 +1665,7 @@ void process_a_keystroke(void)
} else if (openfile->current != was_current)
also_the_last = FALSE;
}
-#endif
- if (!refresh_needed && (function == do_delete || function == do_backspace)) {
-#ifdef ENABLE_COLOR
- check_the_multis(openfile->current);
- if (!refresh_needed)
-#endif
- update_line(openfile->current, openfile->current_x);
- }
-
-#ifndef NANO_TINY
if (bracketed_paste)
suck_up_input_and_paste_it();