Commit Diff


commit - a81bf10dcff37882a92b97bbb892df2b8b667532
commit + bfddd0d9d1a52d2c2f1304f52befa1e20ec83b72
blob - 6bfae94884aef0a0568fa9243d487fabce77523e
blob + 47557c3468d897ae3860fed1cc768648bb859e3d
--- tog/tog.c
+++ tog/tog.c
@@ -333,6 +333,12 @@ view_resize(struct tog_view *view)
 	view->cols = COLS;
 
 	return NULL;
+}
+
+static int
+view_is_splitscreen(struct tog_view *view)
+{
+	return view->begin_x > 0;
 }
 
 static const struct got_error *
@@ -1287,10 +1293,14 @@ input_log_view(struct tog_view **new_view, struct tog_
 			break;
 		case KEY_ENTER:
 		case '\r':
-			*focus_view = view; /* keep log view focussed */
 			err = open_diff_view_for_commit(new_view, view->begin_x,
 			    s->selected_entry->id, s->selected_entry->commit,
 			    s->repo);
+			if (err)
+				break;
+			/* Keep log view focussed in split-screen mode. */
+			if (view_is_splitscreen(*new_view))
+				*focus_view = view;
 			break;
 		case 't':
 			err = browse_commit(new_view, view->begin_x,