commit 4d27f680443116b3694af5348801dd446b091cff from: Mark Jamsek via: Thomas Adam date: Fri Jul 01 21:13:24 2022 UTC tog: echo count prefix when entering compound key maps like less(1), echo the digits as they're typed. suggested by and ok op@ stsp@ commit - 19dd85cbe25c418975d46e00cc13b48e26488715 commit + 4d27f680443116b3694af5348801dd446b091cff blob - 660a543a10294eecf9559d98095e46265a14df11 blob + 5e7564648c9d9abf1f4532d4cd46c8eb464eb51e --- tog/tog.c +++ tog/tog.c @@ -903,12 +903,19 @@ view_search_start(struct tog_view *view) static int get_compound_key(struct tog_view *view, int c) { - int n = 0; + int x, n = 0; view->count = 0; halfdelay(5); /* block for half a second */ + wattron(view->window, A_BOLD); + wmove(view->window, view->nlines - 1, 0); + wclrtoeol(view->window); + waddch(view->window, ':'); do { + x = getcurx(view->window); + if (x != ERR && x < view->ncols) + waddch(view->window, c); /* * Don't overflow. Max valid request should be the greatest * between the longest and total lines; cap at 10 million. @@ -922,6 +929,7 @@ get_compound_key(struct tog_view *view, int c) /* Massage excessive or inapplicable values at the input handler. */ view->count = n; + wattroff(view->window, A_BOLD); cbreak(); /* return to blocking */ return c; }