diff options
author | bodea <bod@c47.org> | 2022-09-06 16:42:02 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 08:42:02 +0200 |
commit | b242bcebcf220b42ee50e0f967c7237a5f543b25 (patch) | |
tree | 9bc46368056944e8199be1b4a001fda2d1df383e | |
parent | ebcd1d43ea9fd08a1dbb1212fb61e42f05a22684 (diff) | |
download | i3-b242bcebcf220b42ee50e0f967c7237a5f543b25.tar.gz i3-b242bcebcf220b42ee50e0f967c7237a5f543b25.zip |
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.
-rwxr-xr-x | i3-sensible-pager | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/i3-sensible-pager b/i3-sensible-pager index 386e2988..2d824684 100755 --- a/i3-sensible-pager +++ b/i3-sensible-pager @@ -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. |