Rationalize $LESS uses

Stop using "--no-init"/"-X" because we have no actual reason to and it
may break mouse initialization on my best friend macOS.

Use --RAW-CONTROL-CHARS, the capital version that only lets through
specific escape sequences, not *everything* - we shouldn't have
anything weird here, but less heavily discourages the other version.

Allow a user's $LESS to override.

Fixes #7997.
This commit is contained in:
Fabian Homborg 2021-05-14 22:18:01 +02:00
parent 2cfb4343ed
commit d15a51897d
2 changed files with 4 additions and 4 deletions

View File

@ -119,13 +119,13 @@ function __fish_print_help --description "Print help message for the specified f
not isatty stdout
and set pager cat # cannot use a builtin here
# similar to man, but add -F to quit paging when the help output is brief (#6227)
set -xl LESS isrFX
not set -qx LESS
and set -xl LESS isRF
# less options:
# -i (--ignore-case) search case-insensitively, like man
# -s (--squeeze-blank-lines) not strictly necessary since we already do that above
# -r (--raw-control-chars) to display bold, underline and colors
# -R (--RAW-CONTROL-CHARS) to display colors and such
# -F (--quit-if-one-screen) to maintain the non-paging behavior for small outputs
# -X (--no-init) not sure if this is needed but git uses it
$pager
end
end

View File

@ -93,7 +93,7 @@ function history --description "display or manipulate interactive command histor
# screen from clearing on quit, so there is something to see if it exits.
# These are two of the options `git` sets through $LESS before starting the pager.
not set -qx LESS
and set -x LESS --quit-if-one-screen --no-init
and set -x LESS --quit-if-one-screen
not set -qx LV # ask the pager lv not to strip colors
and set -x LV -c