Commit 8b5b8d0ca2f5e814f7cf2921c3dbe91e53012a4e

Stefan Sperling 2020-12-06T23:07:07

move the ref view's selection cursor up if the terminal shrinks too much bug found by naddy ok naddy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/tog/tog.c b/tog/tog.c
index 9195924..e67c108 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -6131,8 +6131,8 @@ input_ref_view(struct tog_view **new_view, struct tog_view *view, int ch)
 		err = ref_view_load_refs(s);
 		break;
 	case KEY_RESIZE:
-		if (s->selected > view->nlines)
-			s->selected = s->ndisplayed - 1;
+		if (view->nlines >= 2 && s->selected >= view->nlines - 1)
+			s->selected = view->nlines - 2;
 		break;
 	default:
 		break;