Commits


tog: always use alternate charset for vertical/horizontal line ncurses(3) will use the line drawing characters from the VT100 alternate graphics character set if the terminal supports this as indicated by termcap/terminfo, otherwise it will fall back to ASCII replacement characters. ok jamsek stsp


tog: teach test harness to count and basic tree tests Add count instruction to the test harness to simulate count modifier compound keys (e.g., 11j), and add basic tests for the tree view. ok stsp@


tog regress: zap needless defines and use "vt220" TERM Also, overwrite - and | unconditionally when capturing screen dumps, and unset TOG_COLORS and TOG_DIFF_ALGORITHM in regress setup. All tweaks suggested by naddy@ ok stsp@


tog regress: use pthread conditions for wait instruction As suggested by stsp, rather than busy wait in the view loop, use pthread conditions to wait for the blame thread to signal completion before drawing the screen. We can add more conditions for other views when needed, but by keeping the general WAIT_FOR_UI instruction and flag, this should make their use context-dependent so we won't need more test harness WAIT_* instructions. ok stsp@


tog: lock mutex if leaving view_loop() on a script read error ok stsp@


tog: tweak blame tog_view deallocation fix from 2ca2f982 Both view_close() and close_blame_view() are called from view_loop() irrespective of error, so only call these from cmd_blame() to ensure the tog_view structure is not leaked when open_blame_view() errors. ok stsp@


tog: blame regress and new test framework wait instruction Basic blame view test required adding the WAIT_FOR_UI instruction to delay screen dumps till the ui has been completely rendered. This will also apply to future test cases such as limited log views and further blame test cases. ok stsp@


tog: rename regress test script envvar As per stsp's idea: use a more descriptive name, and use the TOG_TEST_SCRIPT envvar both in tog.c and the test scripts. ok stsp@


document the S key in tog's online help screen


tog: plug tog_view structure leak on open_*_view() error ok stsp@


release tog_io regress mock term resources in main() ok stsp@


make tog regress run with pledge active ok jamsek


tog: implement automated test harness Add framework for scripting tog tests by capturing screen dumps to compare with expected output. Includes some preliminary log view tests but lots more tests are needed to cover diff, blame, tree, ref, and help views. ok stsp@


tog: resume blame and diff search from the first line In diff and blame views, if the user scrolls up during a search, resume search from the first displayed line--not the current match. This makes sense in these views as the "cursor" or current line is the first line. Patch by Mikhail. ok op@


include sha2.h too where sha1.h is included In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


fix tog diff between arbitrary commits Don't assume commit info is always written. This is only true when diffing a commit against (one of) its direct parent(s). Otherwise we perform an invalid read on a tmp got_diff_line array and end up passing bogus offsets to fseeko(). Bug found and fixed by stsp with a minor tweak by me. ok jamsek for stsp's initial diff ok stsp@


got/tog/gotadmin: pledge earlier In the case of tog move setlocale(3) before pledge(2), as suggested by stsp. ok stsp@


tog: reset 1 second refresh rate after starting search This fixes an issue reported by Mikhail where CPU usage continuously increases if search is started after the refresh rate has dropped from 100ms to 1s by resetting the 1s refresh rate if search is started after fast initialisation has finished. This is not needed in limit_log_view() because the 1s refresh rate is reset in draw_commits() once the screen is redrawn (i.e., commits_needed == 0). Tested by and based on initial patch from Mikhail. ok stsp@


tog: add horizontal scroll support to the tree view Suggested by op. tog now supports hscroll in all views so move corresponding keymap docs in tog(1) to global space (this was already the case in tog runtime help). While here, remove some copypasta with a new subroutine to handle hscroll input. ok op@ and stsp@


tog: add horizontal scroll support to the ref view ok op@ and stsp@


fix OB1 in tog ref and tree views causing wrapped lines While here, draw to the last column in tog help. ok op@ and stsp@


don't print empty line when exiting tog Reported and tested by dv: rather than print a new line to avoid clobbering the shell prompt when exiting tog with the alternate screen buffer disabled^, adopt naddy's vi(1) solution by looping through visible views to delete the topmost line, which inserts an empty line at the bottom so we don't need to print an empty line to ensure a clean prompt. ^: xterm -xrm 'XTerm*titeInhibit: 1' or run tog in the console ok naddy@


tog: display action report on user toggleable event If the diff algorithm, ignore whitespace-only changes, force ASCII text diff, show committer/author, or reference sort order keymaps are toggled, report action to the bottom left of screen. Based on initial patch by Mikhail. ok + tweaks op@


tog: fix typo that makes condition always false In view_loop(), we initialise at a refresh rate of one tenth per second before dropping to one second updates; the reduction was never hit due to the typo. Reviewed as part of the following diff adding action reports to user events. ok op@


refactor got log -d and tog diffstat to compute diff once This eliminates the previous performance cost by making 'got log -d' and tog diff view compute the diffstat while building the diff in a temp file like we do with 'got diff -d'. Also, keep the current 'got log -d' UI as per stsp's suggestion. ok stsp@