Commit Diff


commit - e0bcabc59053f9a9eb0fe046fcdc49d36eb46273
commit + 52c5094beddc1ccecba6d468c80d35bdce5bcc67
blob - 04242def3c3bd1f7ec0b24922210fbedced28abb
blob + 53edc5c3c79e0951bfdaf8315a353c3430a7b579
--- regress/tog/diff.sh
+++ regress/tog/diff.sh
@@ -131,6 +131,81 @@ EOF
 	test_done "$testroot" "$ret"
 }
 
+test_diff_J_keymap_on_last_loaded_commit()
+{
+	test_init diff_J_keymap_on_last_loaded_commit 94 24
+
+	local i=0
+
+	cd $testroot/repo
+
+	while [ "$i" -lt 32 ]; do
+		echo $i > alpha
+		git commit -aqm $i
+		if [ $i -eq 6 ]; then
+			local id6=$(git_show_head .)
+			local blobid6=$(get_blob_id . "" alpha)
+		elif [ $i -eq 7 ]; then
+			local id7=$(git_show_head .)
+			local blobid7=$(get_blob_id . "" alpha)
+			local author_time=$(git_show_author_time .)
+		fi
+		i=$(( i + 1 ))
+	done
+
+	local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
+
+	cat <<EOF >$TOG_TEST_SCRIPT
+KEY_ENTER	open diff view of selected commit
+S		toggle horizontal split
+TAB		tab back to log view
+23j		move to last loaded commit
+KEY_ENTER	select last loaded commit
+F		toggle fullscreen
+J		move down to next commit in the log
+SCREENDUMP
+EOF
+
+	cat <<EOF >$testroot/view.expected
+[1/20] diff $id6 $id7
+commit $id7
+from: Flan Hacker <flan_hacker@openbsd.org>
+date: $date
+
+7
+
+M  alpha  |  1+  1-
+
+1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit - $id6
+commit + $id7
+blob - $blobid6
+blob + $blobid7
+--- alpha
++++ alpha
+@@ -1 +1 @@
+-6
++7
+
+
+
+(END)
+EOF
+
+	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_diff_contiguous_commits
 run_test test_diff_arbitrary_commits
+run_test test_diff_J_keymap_on_last_loaded_commit
blob - c6b45a32b54dddc57684075b72aaf17d79656663
blob + 11b06f5c163c7f7ae9770567b2f8f3ba89659353
--- tog/tog.c
+++ tog/tog.c
@@ -1653,6 +1653,8 @@ tog_read_script_key(FILE *script, struct tog_view *vie
 		*ch = KEY_DOWN;
 	else if (strncasecmp(line, "KEY_UP", 6) == 0)
 		*ch = KEY_UP;
+	else if (strncasecmp(line, "TAB", 3) == 0)
+		*ch = '\t';
 	else if (strncasecmp(line, "SCREENDUMP", 10) == 0)
 		*ch = TOG_KEY_SCRDUMP;
 	else if (isdigit((unsigned char)*line)) {