commit 71de0b9e2fc2a88879248f70dbab0e4b3417adca
parent b8c51329f6d8c305d0107819eda060a75c8277c9
Author: Brand Huntsman <alpha@qzx.com>
Date: Sun, 21 Oct 2018 19:14:38 -0600
linter: throttle "first"/"last" message on repeated key presses
To avoid stacking up pauses, which would make nano unresponsive
for too long.
Signed-off-by: Brand Huntsman <alpha@qzx.com>
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -3001,6 +3001,7 @@ void do_linter(void)
pid_t pid_lint;
static char **lintargs = NULL;
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
+ time_t last_wait = 0;
if (ISSET(RESTRICTED)) {
show_restricted_warning();
@@ -3281,17 +3282,19 @@ void do_linter(void)
} else if (func == do_page_up || func == do_prev_block) {
if (curlint->prev != NULL)
curlint = curlint->prev;
- else {
+ else if (last_wait != time(NULL)) {
statusbar(_("At first message"));
napms(600);
+ last_wait = time(NULL);
statusbar(curlint->msg);
}
} else if (func == do_page_down || func == do_next_block) {
if (curlint->next != NULL)
curlint = curlint->next;
- else {
+ else if (last_wait != time(NULL)) {
statusbar(_("At last message"));
napms(600);
+ last_wait = time(NULL);
statusbar(curlint->msg);
}
}