mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
rc git: Make git next/prev-hunk behavior consistent with search command
This commit is contained in:
parent
6766297623
commit
8c7bb10e56
@ -196,6 +196,7 @@ define-command -params 1.. \
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "fail 'no git hunks found'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -212,6 +213,7 @@ define-command -params 1.. \
|
|||||||
prev_line="$line"
|
prev_line="$line"
|
||||||
done
|
done
|
||||||
echo "set-option buffer git_hunk_list $hunks"
|
echo "set-option buffer git_hunk_list $hunks"
|
||||||
|
hunks=${hunks#* }
|
||||||
else
|
else
|
||||||
hunks=${kak_opt_git_hunk_list#* }
|
hunks=${kak_opt_git_hunk_list#* }
|
||||||
fi
|
fi
|
||||||
@ -227,10 +229,26 @@ define-command -params 1.. \
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$direction" = "next" ] && [ -n "$next_hunk" ]; then
|
if [ "$direction" = "next" ]; then
|
||||||
echo "select $next_hunk.1,$next_hunk.1"
|
if [ -z "$next_hunk" ]; then
|
||||||
elif [ "$direction" = "prev" ] && [ -n "$prev_hunk" ]; then
|
next_hunk=${hunks%% *}
|
||||||
echo "select $prev_hunk.1,$prev_hunk.1"
|
wrapped=true
|
||||||
|
fi
|
||||||
|
if [ -n "$next_hunk" ]; then
|
||||||
|
echo "select $next_hunk.1,$next_hunk.1"
|
||||||
|
fi
|
||||||
|
elif [ "$direction" = "prev" ]; then
|
||||||
|
if [ -z "$prev_hunk" ]; then
|
||||||
|
wrapped=true
|
||||||
|
prev_hunk=${hunks##* }
|
||||||
|
fi
|
||||||
|
if [ -n "$prev_hunk" ]; then
|
||||||
|
echo "select $prev_hunk.1,$prev_hunk.1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$wrapped" = true ]; then
|
||||||
|
echo "echo -markup '{Information}git hunk search wrapped around buffer'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user