Skip to content

Commit

Permalink
Rationalize $LESS uses
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
faho committed May 14, 2021
1 parent 2cfb434 commit d15a518
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions share/functions/__fish_print_help.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion share/functions/history.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d15a518

Please sign in to comment.