commit 31607d6c745643159f3f25eee25189cf3b5d8cc2 from: Stefan Sperling date: Sat Aug 18 11:27:14 2018 UTC allow backspace to cycle views backwards in tog commit - 87aa0e9809caded0ed6c399e56a0379e4016d76e commit + 31607d6c745643159f3f25eee25189cf3b5d8cc2 blob - 53ede1f3dfc5ad764f88727e3d729b08a5050549 blob + 3f2551b5751217910c7223a184348710425b4883 --- tog/tog.1 +++ tog/tog.1 @@ -62,6 +62,9 @@ Quit the view which is in focus. .It Cm Tab Switch focus to the next view. Cycles through all open views. +.It Cm Backspace +Switch focus to the previous view. +Cycles through all open views. .El .Pp Global options must precede the command name, and are as follows: @@ -130,7 +133,7 @@ are as follows: .Bl -tag -width Ds .It Cm Down-arrow, j, Page-down, Space Scroll down. -.It Cm Up-arrow, k, Page-up, Backspace +.It Cm Up-arrow, k, Page-up Scroll up. .El .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path @@ -142,7 +145,7 @@ are as follows: .Bl -tag -width Ds .It Cm Down-arrow, j, Page-down, Space Move the selection cursor down. -.It Cm Up-arrow, k, Page-up, Backspace +.It Cm Up-arrow, k, Page-up Move the selection cursor up. .It Cm Enter Switch to the @@ -199,7 +202,7 @@ view for the currently selected file. Switch to the .Cm log view for the currently selected tree entry. -.It Cm Backspace +.It Cm Left-arrow Move back to the parent directory. .It Cm i Show the object IDs for all objects displayed in the blob - a69b40efd775bd78863528bd3c09120b6889b2a3 blob + d99b3015676f0794cf14928b542c43c988307260 --- tog/tog.c +++ tog/tog.c @@ -343,7 +343,7 @@ view_input(struct tog_view **new, struct tog_view **de struct tog_view_list_head *views) { const struct got_error *err = NULL; - struct tog_view *next; + struct tog_view *next, *prev; int ch; *new = NULL; @@ -362,6 +362,13 @@ view_input(struct tog_view **new, struct tog_view **de else *focus = TAILQ_FIRST(views); break; + case KEY_BACKSPACE: + prev = TAILQ_PREV(view, tog_view_list_head, entry); + if (prev) + *focus = prev; + else + *focus = TAILQ_LAST(views, tog_view_list_head); + break; case 'q': err = view->input(new, dead, view, ch); *dead = view; @@ -1438,7 +1445,6 @@ input_diff_view(struct tog_view **new, struct tog_view s->first_displayed_line--; break; case KEY_PPAGE: - case KEY_BACKSPACE: i = 0; while (i++ < view->nlines - 1 && s->first_displayed_line > 1) @@ -2019,7 +2025,6 @@ input_blame_view(struct tog_view **new_view, struct to s->first_displayed_line--; break; case KEY_PPAGE: - case KEY_BACKSPACE: if (s->first_displayed_line == 1) { s->selected_line = 1; break; @@ -2687,7 +2692,7 @@ input_tree_view(struct tog_view **new_view, struct tog case '\r': if (s->selected_entry == NULL) { struct tog_parent_tree *parent; - case KEY_BACKSPACE: + case KEY_LEFT: /* user selected '..' */ if (s->tree == s->root) break;