From e31d59ebc89b209d183a9fb4aa5bec27f5ce61d3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 17 Aug 2022 08:50:38 +0200 Subject: [PATCH] tweaks: move two checks plus corresponding calls to a better place It was silly to check again specifically for and 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 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.) --- src/cut.c | 7 +++++++ src/nano.c | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/cut.c b/src/cut.c index ac0f45f3..3c0483cb 100644 --- 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 index 85f9d551..aa76f025 100644 --- 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();