i3-sensible-pager: sanitize LESS environment variable (#5111)

When an error is encountered such as "The configured command for this shortcut
could not be run successfully", the "show errors" button on i3-nagbar doesn't
work if $PAGER is less, and $LESS contains either the -E or -F flag (the
window pops up, but immediately disappears).

Strip these flags from the LESS environment variable before invoking $pager.
This commit is contained in:
bodea 2022-09-06 16:42:02 +10:00 committed by GitHub
parent ebcd1d43ea
commit b242bcebcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,11 @@
# Distributions/packagers can enhance this script with a
# distribution-specific mechanism to find the preferred pager.
# The less -E and -F options exit immediately for short files, strip if present.
case "$LESS" in
*[EF]*) LESS=`echo "$LESS" | tr -d EF`
esac
# Hopefully one of these is installed (no flamewars about preference please!):
# We don't use 'more' because it will exit if the file is too short.
# Worst case scenario we'll open the file in your editor.