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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: u/ctrl-u/d/ctrl-d bindings for scrolling in tog
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Fri, 17 Jun 2022 10:04:35 +0200

Download raw body.

Thread
On Fri, Jun 17, 2022 at 05:28:59PM +1000, Mark Jamsek wrote:
> On 22-06-16 10:29pm, Stefan Sperling wrote:
> > On Thu, Jun 16, 2022 at 10:18:09PM +0200, Christian Weisgerber wrote:
> > > Stefan Sperling:
> > > 
> > > > I have committed this. And I hope everyone is happy now :)
> > > 
> > > If ^D/^U have aliases d/u for compatibility with less, then ^F/^B
> > > should also have f/b aliases.  (I just realized I actually use 'b'
> > > in less.)  That would also imply that the blame view's 'b' needs
> > > to move to a different key.
> > 
> > Sure. It looks like 'c' (commit) would be available to replace 'b'?
> > 
> > There are also 'B' shortcuts (Shift+b); do any of these need to change?
> > 
> 
> I don't think the 'B' key maps need to change, but if we want to alias
> b/f, we need to change 'f'ullscreen. The following patch adds the b/f
> aliases for C-b/C-f, changes blame view 'b' to 'c', and changes the
> fullscreen key map to 'F'. Also removes a couple trailing whitespace.

naddy, are you happy with this?
Seems ok to me, but since you asked it would be good to get your opinion.

> diff 95d136acd37c706e1f4874b6606e5b70917a0d79 /home/mark/src/git/got-current
> blob - 31dd5084aea96d44619fbb6cccdbd3f12ca27915
> file + tog/tog.1
> --- tog/tog.1
> +++ tog/tog.1
> @@ -64,7 +64,7 @@ Quit
>  Quit the view which is in focus.
>  .It Cm Tab
>  Switch focus between views.
> -.It Cm f
> +.It Cm F
>  Toggle fullscreen mode for a split-screen view.
>  .Nm
>  will automatically use split-screen views if the size of the terminal
> @@ -114,9 +114,9 @@ Log message moves right on the screen.
>  Scroll log message field to the rightmost position.
>  .It Cm 0
>  Scroll log message field to the leftmost position.
> -.It Cm Page-down, Ctrl+f
> +.It Cm Page-down, Ctrl+f, f
>  Move the selection cursor down one page.
> -.It Cm Page-up, Ctrl+b
> +.It Cm Page-up, Ctrl+b, b
>  Move the selection cursor up one page.
>  .It Cm Ctrl+d, d
>  Move the selection cursor down one half page.
> @@ -239,9 +239,9 @@ Diff output moves right on the screen.
>  Scroll view to the rightmost position.
>  .It Cm 0
>  Scroll view left to the start of the line.
> -.It Cm Page-down, Space, Ctrl+f
> +.It Cm Page-down, Space, Ctrl+f, f
>  Scroll down one page.
> -.It Cm Page-up, Ctrl+b
> +.It Cm Page-up, Ctrl+b, b
>  Scroll up one page.
>  .It Cm Ctrl+d, d
>  Scroll down one half page.
> @@ -320,9 +320,9 @@ File output moves right on the screen.
>  Scroll view to the rightmost position.
>  .It Cm 0
>  Scroll view left to the start of the line.
> -.It Cm Page-down, Space, Ctrl+f
> +.It Cm Page-down, Space, Ctrl+f, f
>  Move the selection cursor down one page.
> -.It Cm Page-up, Ctrl+b
> +.It Cm Page-up, Ctrl+b, b
>  Move the selection cursor up one page.
>  .It Cm Ctrl+d, d
>  Move the selection cursor down one half page.
> @@ -336,7 +336,7 @@ Move the selection cursor to the last line of the file
>  Open a
>  .Cm diff
>  view for the currently selected line's commit.
> -.It Cm b
> +.It Cm c
>  Reload the
>  .Cm blame
>  view with the version of the file as found in the currently
> @@ -403,9 +403,9 @@ are as follows:
>  Move the selection cursor down.
>  .It Cm Up-arrow, k, Ctrl-p
>  Move the selection cursor up.
> -.It Cm Page-down, Ctrl+f
> +.It Cm Page-down, Ctrl+f, f
>  Move the selection cursor down one page.
> -.It Cm Page-up, Ctrl+b
> +.It Cm Page-up, Ctrl+b, b
>  Move the selection cursor up one page.
>  .It Cm Ctrl+d, d
>  Move the selection cursor down one half page.
> @@ -477,9 +477,9 @@ are as follows:
>  Move the selection cursor down.
>  .It Cm Up-arrow, k, Ctrl-p
>  Move the selection cursor up.
> -.It Cm Page-down, Ctrl+f
> +.It Cm Page-down, Ctrl+f, f
>  Move the selection cursor down one page.
> -.It Cm Page-up, Ctrl+b
> +.It Cm Page-up, Ctrl+b, b
>  Move the selection cursor up one page.
>  .It Cm Ctrl+d, d
>  Move the selection cursor down one half page.
> blob - 36dceb28705dddb875b725d732b6dea27d63158d
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -958,7 +958,7 @@ view_input(struct tog_view **new, int *done, struct to
>  	case 'Q':
>  		*done = 1;
>  		break;
> -	case 'f':
> +	case 'F':
>  		if (view_is_parent_view(view)) {
>  			if (view->child == NULL)
>  				break;
> @@ -1263,7 +1263,7 @@ expand_tab(char **ptr, const char *src)
>  	return NULL;
>  }
> 
> -/*
> +/*
>   * Skip leading nscroll columns of a wide character string.
>   * Returns the index to the first character of the scrolled string.
>   */
> @@ -2639,6 +2639,7 @@ input_log_view(struct tog_view **new_view, struct tog_
>  		/* FALL THROUGH */
>  	case KEY_PPAGE:
>  	case CTRL('b'):
> +	case 'b':
>  		if (s->first_displayed_entry == NULL)
>  			break;
>  		if (TAILQ_FIRST(&s->commits.head) == s->first_displayed_entry)
> @@ -2691,7 +2692,8 @@ input_log_view(struct tog_view **new_view, struct tog_
>  		nscroll /= 2;
>  		/* FALL THROUGH */
>  	case KEY_NPAGE:
> -	case CTRL('f'): {
> +	case CTRL('f'):
> +	case 'f': {
>  		struct commit_queue_entry *first;
>  		first = s->first_displayed_entry;
>  		if (first == NULL)
> @@ -3193,7 +3195,7 @@ add_matched_line(int *wtotal, const char *line, int wl
>  			}
>  			if (width0 + w + width > skipcol)
>  				break;
> -			w += width;
> +			w += width;
>  			i++;
>  		}
>  		/* draw (visible part of) matched token (if scrolled into it) */
> @@ -4062,6 +4064,7 @@ input_diff_view(struct tog_view **new_view, struct tog
>  		/* FALL THROUGH */
>  	case KEY_PPAGE:
>  	case CTRL('b'):
> +	case 'b':
>  		if (s->first_displayed_line == 1)
>  			break;
>  		i = 0;
> @@ -4080,6 +4083,7 @@ input_diff_view(struct tog_view **new_view, struct tog
>  		/* FALL THROUGH */
>  	case KEY_NPAGE:
>  	case CTRL('f'):
> +	case 'f':
>  	case ' ':
>  		if (s->eof)
>  			break;
> @@ -5004,6 +5008,7 @@ input_blame_view(struct tog_view **new_view, struct to
>  		/* FALL THROUGH */
>  	case KEY_PPAGE:
>  	case CTRL('b'):
> +	case 'b':
>  		if (s->first_displayed_line == 1) {
>  			s->selected_line = MAX(1, s->selected_line - nscroll);
>  			break;
> @@ -5024,7 +5029,7 @@ input_blame_view(struct tog_view **new_view, struct to
>  		    s->blame.nlines)
>  			s->first_displayed_line++;
>  		break;
> -	case 'b':
> +	case 'c':
>  	case 'p': {
>  		struct got_object_id *id = NULL;
>  		id = get_selected_commit_id(s->blame.lines, s->blame.nlines,
> @@ -5160,6 +5165,7 @@ input_blame_view(struct tog_view **new_view, struct to
>  		/* FALL THROUGH */
>  	case KEY_NPAGE:
>  	case CTRL('f'):
> +	case 'f':
>  	case ' ':
>  		if (s->last_displayed_line >= s->blame.nlines &&
>  		    s->selected_line >= MIN(s->blame.nlines,
> @@ -5960,6 +5966,7 @@ input_tree_view(struct tog_view **new_view, struct tog
>  		/* FALL THROUGH */
>  	case KEY_PPAGE:
>  	case CTRL('b'):
> +	case 'b':
>  		if (s->tree == s->root) {
>  			if (got_object_tree_get_first_entry(s->tree) ==
>  			    s->first_displayed_entry)
> @@ -5989,6 +5996,7 @@ input_tree_view(struct tog_view **new_view, struct tog
>  		/* FALL THROUGH */
>  	case KEY_NPAGE:
>  	case CTRL('f'):
> +	case 'f':
>  		if (got_tree_entry_get_next(s->tree, s->last_displayed_entry)
>  		    == NULL) {
>  			/* can't scroll any further; move cursor down */
> @@ -6831,6 +6839,7 @@ input_ref_view(struct tog_view **new_view, struct tog_
>  		/* FALL THROUGH */
>  	case KEY_PPAGE:
>  	case CTRL('b'):
> +	case 'b':
>  		if (s->first_displayed_entry == TAILQ_FIRST(&s->refs))
>  			s->selected -= MIN(nscroll, s->selected);
>  		ref_scroll_up(s, MAX(0, nscroll));
> @@ -6853,6 +6862,7 @@ input_ref_view(struct tog_view **new_view, struct tog_
>  		/* FALL THROUGH */
>  	case KEY_NPAGE:
>  	case CTRL('f'):
> +	case 'f':
>  		if (TAILQ_NEXT(s->last_displayed_entry, entry) == NULL) {
>  			/* can't scroll any further; move cursor down */
>  			if (s->selected < s->ndisplayed - 1)
> 
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68