This commit is contained in:
Dylan Araps 2020-08-04 14:10:55 +03:00
parent e5fd2c415e
commit 1dc38aa4ef
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 15 additions and 5 deletions

20
shfm
View File

@ -50,7 +50,11 @@ hist_search() {
for file do
case ${PWD%%/}/$file in
"$old_pwd") y=$j y2=$((j > bottom ? bottom : j)) cur=$file
"$old_pwd")
y=$j
y2=$((j > bottom ? mid : j))
cur=$file
;;
esac
j=$((j + 1))
@ -62,12 +66,18 @@ list_print() {
i=1
end=$((bottom + 1))
mid=$((bottom / 4 < 5 ? 1 : bottom / 4))
case $hist in
1) hist_search "$@"
esac
1)
hist_search "$@"
shift "$((y >= bottom ? y - mid : 0))"
;;
shift "$((y - bottom > 0 ? y - bottom : 0))"
*)
shift "$((y >= bottom ? y - bottom : 0))"
;;
esac
for file do
file_escape "$file"
@ -83,7 +93,7 @@ list_print() {
i=$((i + 1))
done
printf '\033[%sH' "$((y > bottom ? bottom : y))"
printf '\033[%sH' "$((y > bottom ? y2 : y))"
}
redraw() {