From f193b15bbf62d8199ab217e4551e97b90f1ee606 Mon Sep 17 00:00:00 2001 From: Susensio Date: Wed, 17 Jan 2018 16:20:44 +0100 Subject: [PATCH] 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. --- tldr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tldr b/tldr index d7078f9..57bf1fd 100755 --- a/tldr +++ b/tldr @@ -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