Skip to content

Commit

Permalink
jj-fzf: cut off the preview after a few thausand lines
Browse files Browse the repository at this point in the history
Cutting off the preview process at a point where users are
unlikely to scroll to vastly improves preview performance
for giant imports.

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Dec 22, 2024
1 parent 967a421 commit e6afe36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jj-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ then
then
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} evolog --color=always -r "$REVISION"
else # show commit and diff
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} log --color=always --no-graph -T "$JJ_FZF_SHOWDETAILS" -s -r "$REVISION"
exec jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} show --color=always -T ' "\n" ' -r "$REVISION" --ignore-space-change
{ jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} log --color=always --no-graph -T "$JJ_FZF_SHOWDETAILS" -s -r "$REVISION"
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} show --color=always -T ' "\n" ' -r "$REVISION" --ignore-space-change
} | head -n 4000
fi
else # no valid revision
true
Expand All @@ -67,7 +68,7 @@ case "${1:-}" in
preview_oppatch)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op show -p "${BASH_REMATCH[1]}"
} ; exit ;;
} | head -n 4000 ; exit ;;
preview_opdiff)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op diff -f "${BASH_REMATCH[1]}" -t @
Expand Down

0 comments on commit e6afe36

Please sign in to comment.