Fix less percentage

The problem is that less can't say what percent into the file you are until it knows how long the file is, and it doesn't read to the end of the file by default when reading from a pipe. 
If a command line option begins with +, the remainder of that option is taken to be an initial command to less.
+Gg command forces less to read to the end and back to the beginning of the file FIRST, before building the statusbar.
This commit is contained in:
Susensio 2018-01-17 16:20:44 +01:00 committed by GitHub
parent 255b9febd9
commit f193b15bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

2
tldr
View File

@ -333,7 +333,7 @@ Display_tldr(){
done <"$1"
[[ $TLDR_LESS = 0 ]] &&
trap 'cat <<<"$stdout"' EXIT ||
trap 'less -Gg -~RXQFP"%pB\% tldr $I$page$XI - browse up/down, press Q to exit" <<<"$stdout"' EXIT
trap 'less +Gg -~RXQFP"%pB\% tldr $I$page$XI - browse up/down, press Q to exit" <<<"$stdout"' EXIT
}
# $1: exit code; Uses: platform index