Skip to content

Commit

Permalink
Fix less percentage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Susensio authored Jan 17, 2018
1 parent 255b9fe commit f193b15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tldr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f193b15

Please sign in to comment.