make tog block other keys except Backspace after End/G is pressed This should avoid unexpected behaviour resulting from unrelated key presses messing with the log view's state variables. Pointed out by tracey, and also discussed with jasper. ok tracey
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/tog/tog.c b/tog/tog.c
index 6634343..b9c4abb 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2389,16 +2389,20 @@ input_log_view(struct tog_view **new_view, struct tog_view *view, int ch)
struct tog_view *ref_view = NULL;
int begin_x = 0;
- switch (ch) {
- case ERR: /* no user input from wgetch() */
- if (s->thread_args.load_all && s->thread_args.log_complete) {
+ if (s->thread_args.load_all) {
+ if (ch == KEY_BACKSPACE)
+ s->thread_args.load_all = 0;
+ else if (s->thread_args.log_complete) {
s->thread_args.load_all = 0;
log_scroll_down(view, s->commits.ncommits);
s->selected = MIN(view->nlines - 2,
s->commits.ncommits - 1);
select_commit(s);
}
- break;
+ return NULL;
+ }
+
+ switch (ch) {
case 'q':
s->quit = 1;
break;
@@ -2542,11 +2546,6 @@ input_log_view(struct tog_view **new_view, struct tog_view *view, int ch)
case KEY_BACKSPACE:
case CTRL('l'):
case 'B':
- if (s->thread_args.load_all) {
- if (ch == KEY_BACKSPACE)
- s->thread_args.load_all = 0;
- break;
- }
if (ch == KEY_BACKSPACE &&
got_path_is_root_dir(s->in_repo_path))
break;