commit fa502711bbf1a59b3e27e7fb6adc03b16a15892a from: Mark Jamsek via: Thomas Adam date: Sun Jul 03 22:07:55 2022 UTC tog: remove count prefix timeout and bold output Suggested by naddy. block till non-numeric input is entered, and don't echo in bold. ok naddy@ op@ and stsp@ commit - 244157854d2ab9af6728127cdda70af4c5b83444 commit + fa502711bbf1a59b3e27e7fb6adc03b16a15892a blob - ed0412fd13daaa1ea18139730716db483ba49274 blob + 18d37fe0f1b21d153863f1bcf024ecca990a307a --- tog/tog.1 +++ tog/tog.1 @@ -58,12 +58,10 @@ provides global and command-specific key bindings and Some command-specific key bindings may be prefixed with an integer, which is denoted by N in the descriptions below, and is used as a modifier to the operation as indicated. -When the first integer for a count modifier is entered, .Nm -will wait 500 milliseconds for each successive integer or the compound sequence -to complete. -If this sequence should timeout or does not conclude with a valid key binding, -the command is aborted and any preceding count is reset. +will echo digits to the screen when count modifiers are entered, and complete +the sequence upon input of the first non-numeric character. +Count modifiers can be aborted by entering an unmapped key. The global key bindings are: .Bl -tag -width Ds .It Cm Q blob - 592da37bd19ed04539b7178e2b0ba0af627db8b7 blob + d22799a47ef9bd147f72ae35dbe392bcadb72680 --- tog/tog.c +++ tog/tog.c @@ -1004,10 +1004,8 @@ view_search_start(struct tog_view *view) } /* - * Compute view->count from numeric user input. User has five-tenths of a - * second to follow each numeric keypress with another number to form count. - * Return first non-numeric input or ERR and assign total to view->count. - * XXX Should we add support for user-defined timeout? + * Compute view->count from numeric input. Assign total to view->count and + * return first non-numeric key entered. */ static int get_compound_key(struct tog_view *view, int c) @@ -1022,8 +1020,7 @@ get_compound_key(struct tog_view *view, int c) v = view->parent; view->count = 0; - halfdelay(5); /* block for half a second */ - wattron(v->window, A_BOLD); + cbreak(); /* block for input */ wmove(v->window, v->nlines - 1, 0); wclrtoeol(v->window); waddch(v->window, ':'); @@ -1048,8 +1045,6 @@ get_compound_key(struct tog_view *view, int c) /* Massage excessive or inapplicable values at the input handler. */ view->count = n; - wattroff(v->window, A_BOLD); - cbreak(); /* return to blocking */ return c; }