mirror of
https://github.com/Fakerr/git-recall.git
synced 2026-09-10 07:26:42 -04:00
Cleanup diff gracefully
This commit is contained in:
parent
d7aa17d02c
commit
8db954a2d6
12
git-recall
12
git-recall
|
|
@ -191,15 +191,23 @@ function get_diff() {
|
||||||
DIFF_LINES_NUMBER=$(( DIFF_LINES_NUMBER + off ))
|
DIFF_LINES_NUMBER=$(( DIFF_LINES_NUMBER + off ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup_diff()
|
||||||
|
{
|
||||||
|
clear_screen
|
||||||
|
cleanup_and_exit
|
||||||
|
}
|
||||||
|
|
||||||
# This function will print the diff according the commit's tip. If the diff is too long, the result will be displayed using 'less'.
|
# This function will print the diff according the commit's tip. If the diff is too long, the result will be displayed using 'less'.
|
||||||
function print_diff() {
|
function print_diff() {
|
||||||
get_diff
|
get_diff
|
||||||
if [[ $(( TN + DIFF_LINES_NUMBER + OFFSET )) -ge $(( `tput lines` - 1 )) ]]; then
|
if [[ $(( TN + DIFF_LINES_NUMBER + OFFSET )) -ge $(( `tput lines` - 1 )) ]]; then
|
||||||
|
trap cleanup_diff INT
|
||||||
if [[ $LESSKEY = true ]]; then
|
if [[ $LESSKEY = true ]]; then
|
||||||
echo "$DIFF" | less -r -k $HOME/.lsh_less_keys_tmp
|
(echo "$DIFF" | less -r -k $HOME/.lsh_less_keys_tmp)
|
||||||
else
|
else
|
||||||
echo "$DIFF" | less -r
|
(echo "$DIFF" | less -r)
|
||||||
fi
|
fi
|
||||||
|
trap cleanup_and_exit INT
|
||||||
clear_screen
|
clear_screen
|
||||||
else
|
else
|
||||||
stop=false
|
stop=false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue