commit - 9976affb503011ab063f1de78688b26414d8ec9a
commit + fe354d70d4ad218c599cac447058537d734836e5
blob - 01a33201435af4ba4c618c10db784372be30bea2
blob + 77e67c8632bd152393715a611f8d74a820e0e3c5
--- regress/tog/log.sh
+++ regress/tog/log.sh
test_done "$testroot" 0
}
+
+test_log_tiny_child_tree_view()
+{
+ test_init log_tiny_child_tree_view 120 3
+
+ local id=$(git_show_head $testroot/repo)
+
+ # This test covers the offset_selection_down() path ensuring
+ # indexes are properly clamped to prevent negative values.
+ cat <<-EOF >$TOG_TEST_SCRIPT
+ T open tree view in vsplit
+ F toggle fullscreen to hit offset_selection_down()
+ SCREENDUMP
+ EOF
+ cat <<-EOF >$testroot/view.expected
+ commit $id
+ [1/4] /
+
+ EOF
+
+ cd $testroot/repo && tog log
+ cmp -s $testroot/view.expected $testroot/view
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ diff -u $testroot/view.expected $testroot/view
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ test_done "$testroot" "$ret"
+}
+
test_parseargs "$@"
run_test test_log_hsplit_diff
run_test test_log_vsplit_diff
run_test test_log_search
run_test test_log_mark_keymap
run_test test_log_worktree_entries
+run_test test_log_tiny_child_tree_view
blob - 879259f6229b008b4113a82b1138cd2193670ee0
blob + 2f26d13b606488dfcb50b4273bb71e143d93b757
--- tog/tog.c
+++ tog/tog.c
view->offset = offset;
if (scrolld && offset) {
err = scrolld(view, offset);
- *selected -= offset;
+ *selected -= MIN(*selected, offset);
}
}