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>master
parent
b8c51329f6
commit
71de0b9e2f
|
@ -3001,6 +3001,7 @@ void do_linter(void)
|
||||||
pid_t pid_lint;
|
pid_t pid_lint;
|
||||||
static char **lintargs = NULL;
|
static char **lintargs = NULL;
|
||||||
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
||||||
|
time_t last_wait = 0;
|
||||||
|
|
||||||
if (ISSET(RESTRICTED)) {
|
if (ISSET(RESTRICTED)) {
|
||||||
show_restricted_warning();
|
show_restricted_warning();
|
||||||
|
@ -3281,17 +3282,19 @@ void do_linter(void)
|
||||||
} else if (func == do_page_up || func == do_prev_block) {
|
} else if (func == do_page_up || func == do_prev_block) {
|
||||||
if (curlint->prev != NULL)
|
if (curlint->prev != NULL)
|
||||||
curlint = curlint->prev;
|
curlint = curlint->prev;
|
||||||
else {
|
else if (last_wait != time(NULL)) {
|
||||||
statusbar(_("At first message"));
|
statusbar(_("At first message"));
|
||||||
napms(600);
|
napms(600);
|
||||||
|
last_wait = time(NULL);
|
||||||
statusbar(curlint->msg);
|
statusbar(curlint->msg);
|
||||||
}
|
}
|
||||||
} else if (func == do_page_down || func == do_next_block) {
|
} else if (func == do_page_down || func == do_next_block) {
|
||||||
if (curlint->next != NULL)
|
if (curlint->next != NULL)
|
||||||
curlint = curlint->next;
|
curlint = curlint->next;
|
||||||
else {
|
else if (last_wait != time(NULL)) {
|
||||||
statusbar(_("At last message"));
|
statusbar(_("At last message"));
|
||||||
napms(600);
|
napms(600);
|
||||||
|
last_wait = time(NULL);
|
||||||
statusbar(curlint->msg);
|
statusbar(curlint->msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue