"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: echo numeric prefix of compound key maps
To:
Mark Jamsek <mark@jamsek.com>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 26 Jun 2022 16:23:55 +0200

Download raw body.

Thread
On Mon, Jun 27, 2022 at 12:03:22AM +1000, Mark Jamsek wrote:
> Similar to less(1), echo the numbers at the bottom of the screen as they
> are typed when entering a compound key map (e.g., 123j).

This is working well for me, thanks! ok by me

> diff 3d589bee0bbbe812bb91f3b0284fbf2596304132 /home/mark/src/git/got-current
> blob - e63f4a7c65678ce2cdbd63fb24abb940c2551358
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -896,12 +896,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.
> @@ -915,6 +922,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;
>  }
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68