sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
49.03k stars 1.24k forks source link

Zsh tab complete with -l flag is broken #2897

Open guiltiest-gear opened 6 months ago

guiltiest-gear commented 6 months ago

What steps will reproduce the bug?

  1. Open a zsh shell with tab completion enabled
  2. Type bat -l and press the tab key three times to get into the completion menu

What happens?

The actual text in the prompt is incorrect, as it displays a string of various other characters, rather than the actual result expected

What did you expect to happen instead?

For tab complete to function normally, selecting the text in the menu and placing it into the prompt, looking more something akin to $ bat -lbash

How did you install bat?

pacman

bat version and environment

Software version

bat 0.24.0 (fc954685)

Operating system

Linux 6.7.9-arch1-1

Command-line

bat --diagnostic 

Environment variables

SHELL=/bin/zsh
PAGER=<not set>
LESS=<not set>
LANG=en_US.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=/home/jade/.config
XDG_CACHE_HOME=/home/jade/.cache
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER='sh -c '\''col -bx | bat -l man -p'\'''

System Config file

Could not read contents of '/etc/bat/config': No such file or directory (os error 2).

Config file

# This is `bat`s configuration file. Each line either contains a comment or
# a command-line option that you want to pass to `bat` by default. You can
# run `bat --help` to get a list of all possible configuration options.

# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
# for a list of all available themes
--theme="tokyonight_night"

# Enable this to use italic text on the terminal. This is not supported on all
# terminal emulators (like tmux, by default):
--italic-text=always

# Uncomment the following line to disable automatic paging:
#--paging=never

# Uncomment the following line if you are using less version >= 551 and want to
# enable mouse scrolling support in `bat` when running inside tmux. This might
# disable text selection, unless you press shift.
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"

# Syntax mappings: map a certain filename pattern to a language.
#   Example 1: use the C++ syntax for .ino files
#   Example 2: Use ".gitignore"-style highlighting for ".ignore" files
#--map-syntax "*.ino:C++"
#--map-syntax ".ignore:Git Ignore"
--style=full
--color=always
--decorations=always

Custom assets metadata

bat_version: 0.24.0
creation_time:
  secs_since_epoch: 1709359655
  nanos_since_epoch: 606552614

Custom assets

Compile time information

Less version

> less --version 
less 643 (PCRE2 regular expressions)
Copyright (C) 1984-2023  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less
wugeer commented 3 months ago

Hello, can you give me a screenshot of what you think is abnormal?

guiltiest-gear commented 3 months ago

Of course, here's a screenshot showing what happens. A screenshot of tab complete with zsh, showing the incorrect output on the command line

Though I do have a few plugins installed for zsh, disabling all of them, including my starship prompt yielded no change, as I initially thought it was an issue with those causing some issues with this.

guiltiest-gear commented 1 month ago

Hi there, it's been more than two months since any activity has occurred on this issue, and looking into the completions file, I can only guess some bug is occurring with the parsing of the output of bat --list-languages. Any help to find the reason for this bug would be greatly appreciated.