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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: reset blame view's scroll position
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 13 Dec 2020 18:32:55 +0100

Download raw body.

Thread
On Sun, Dec 13, 2020 at 05:42:05PM +0100, Christian Weisgerber wrote:
> This CHANGES entry...
> 
> - tog: reset diff view's scroll position if diff context shrinks too much
> 
> ... reminded me that we have a similar issue in the blame view.
> 
> * tog blame -r got.git tog/tog.c
> * move to the very last line
> * hit 'b'
> * congratulations, you are now on line 6493 of 203, and have a whole
>   lot of moving up to do before you encounter your first line of code
>   across this vast desert of emptiness
 
:)

Future feature idea:
Perhaps we should offer a command which jumps to a particular line
in the blame/diff views? The ':' key is unused. It could prompt for
a line-number and scroll to the corresponding line. Then we could
go back to the top by typing ': 1 Enter'

> How about this?

Yes, works for me. OK.
 
> diff b2d2e70d74ef419da60fefbc2a7c5900c181e2e7 /home/naddy/got
> blob - 99232045ade1a4d37286e512dd4999368a1b89b5
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -4254,6 +4254,12 @@ run_blame(struct tog_view *view)
>  	blame->thread_args.cancel_arg = &s->done;
>  	s->blame_complete = 0;
>  
> +	if (s->first_displayed_line + view->nlines - 1 > blame->nlines) {
> +		s->first_displayed_line = 1;
> +		s->last_displayed_line = view->nlines;
> +		s->selected_line = 1;
> +	}
> +
>  done:
>  	if (blob)
>  		got_object_blob_close(blob);
> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de
> 
>