mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-30 10:06:12 +00:00
fix(completions): force --no-paging on bat invocations in completion scripts (#3760)
Every shell completion script (bash, zsh, fish, PowerShell) shells out to bat to enumerate languages/themes for tab completion candidates. If the user has wired bat into LESSOPEN (e.g. LESSOPEN='|-bat -f -pp %s'), bat's normal pager auto-detection can engage when stdout looks like a terminal at completion time and reflect ANSI escape sequences back into the candidate list. The result is the issue's reproducer: tab completion expands 'Per' to '\033[38;2;248;248;242mPerl' instead of 'Perl'. The list-languages/list-themes calls are always meant to be machine- readable, so they should never page. Pass --no-paging explicitly to every bat invocation inside the four completion files. The flag is the public alias for --paging=never (already documented in bat --help) and is the same form completion scripts elsewhere in the codebase use. Touches the four completion files only; no production code changes.
This commit is contained in:
5 files changed
+14
-13
No files matched your search
Vendored
+3
-3
@@ -95,20 +95,20 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
||||
# language name is offered as the completion value; the matchers
|
||||
# show up as the menu description. See
|
||||
# https://github.com/sharkdp/bat/issues/3735.
|
||||
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-languages)"} )
|
||||
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --no-paging --color=never --decorations=never --list-languages)"} )
|
||||
|
||||
_describe 'language' languages && ret=0
|
||||
;;
|
||||
|
||||
themes)
|
||||
local -a themes expl
|
||||
themes=(${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-themes)"} )
|
||||
themes=(${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --no-paging --color=never --decorations=never --list-themes)"} )
|
||||
|
||||
_wanted themes expl 'theme' compadd -a themes && ret=0
|
||||
;;
|
||||
theme_preferences)
|
||||
local -a themes expl
|
||||
themes=(auto dark light auto:always auto:system ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-themes)"} )
|
||||
themes=(auto dark light auto:always auto:system ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --no-paging --color=never --decorations=never --list-themes)"} )
|
||||
|
||||
_wanted themes expl 'theme' compadd -a themes && ret=0
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user