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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: reset view->offset in log view
To:
Mark Jamsek <mark@jamsek.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 22 Jul 2022 15:36:32 +0200

Download raw body.

Thread
On Fri, Jul 22, 2022 at 11:22:04PM +1000, Mark Jamsek wrote:
> Nice, simple fix :)
> 
> We need to clear view->offset in the log view 'B', C-l, and backspace
> case to prevent moving the selection cursor.
> 
> repro in got repo:
>   $ tog (or tog tog)  # 80x24
>   S  # switch to hsplit
>   23j
>   return
>   tab  # focus log/top split
>   C-l or B (or backspace)
>   tab  # focus diff/bottom split
>   q
>   *log selection cursor will move down*
> 
> This happens because the stored offset value is now bogus as we reset
> all positions with the C-l or B or backspace key maps--we need to reset
> view->offset too.

Yes, the problem can be reproduced and your fix works. ok stsp

> diff /home/mark/src/git/got-current
> commit - 598eac4331d322ab9e91ee6864c54845e3a6e86c
> path + /home/mark/src/git/got-current
> blob - 491d7334d3a574341848941ad1da39adb80cd6f7
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -3463,6 +3463,7 @@ input_log_view(struct tog_view **new_view, struct tog_
>  		s->thread_args.commits_needed = view->lines;
>  		s->matched_entry = NULL;
>  		s->search_entry = NULL;
> +		view->offset = 0;
>  		break;
>  	case 'r':
>  		view->count = 0;
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68