Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Wrapping for File Paths within fzf Preview Window #3172

Open
salmankhilji opened this issue Jan 9, 2025 · 0 comments
Open

Incorrect Wrapping for File Paths within fzf Preview Window #3172

salmankhilji opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@salmankhilji
Copy link

salmankhilji commented Jan 9, 2025

bat version 0.25 breaks the way long pathnames are wrapped within a wide terminal when running inside the fzf preview window. Version 0.24 handles this correctly.

Even though the terminal is approximately 200 characters wide, the pathname wraps prematurely.

What steps will reproduce the bug?

  1. Install fzf. I am using version 0.57.

  2. Run the following commands:

    cd /tmp
    mkdir -p frameworks/base/packages/ExternalStorageProvider/src/com/android/externalstorage
    fzf --man >frameworks/base/packages/ExternalStorageProvider/src/com/android/externalstorage/fzf_man_page
    FZF_DEFAULT_COMMAND='echo frameworks/base/packages/ExternalStorageProvider/src/com/android/externalstorage/fzf_man_page:15:' fzf --delimiter : --preview "bat --color=always {1} --style=changes,header,grid,numbers" --preview-window 'up:70%'
    

What happens? (Version 0.25)

Screenshot from 2025-01-09 00-59-03

The pathname wraps prematurely, even though the terminal is wide enough to accommodate the entire length.

What did you expect to happen instead? (Version 0.24)

Screenshot from 2025-01-09 00-59-53

The latter screenshot was captured using bat version 0.24, where the pathname is displayed correctly without premature wrapping.

Workaround

You can manually pass the --terminal-width option to bat using the value of $FZF_PREVIEW_COLUMNS within your preview command.

How did you install bat?

curl -Lf https://github.com/sharkdp/bat/releases/download/v0.25.0/bat-v0.25.0-x86_64-unknown-linux-musl.tar.gz | tar xz -C ~/.local/bin --strip-components=1 --wildcards '*/bat'

bat version and environment

Ubuntu 20.04 LTS.

Software version

bat 0.25.0 (25f4f96)

Operating system

Linux 5.15.0-130-generic

Command-line

bat --diagnostic 

Environment variables

BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
COLORTERM=truecolor
LANG=en_US.UTF-8
LC_ALL=<not set>
LESS=<not set>
MANPAGER=<not set>
NO_COLOR=<not set>
PAGER=<not set>
SHELL=/bin/bash
TERM=xterm-kitty
XDG_CACHE_HOME=<not set>
XDG_CONFIG_HOME=<not set>

System Config file

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

Config file

--theme=Coldark-Dark

Custom assets metadata

Could not read contents of '/home/precor/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'/home/precor/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-musl
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Less version

> less --version 
less 551 (GNU regular expressions)
Copyright (C) 1984-2019  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: http://www.greenwoodsoftware.com/less
@salmankhilji salmankhilji added the bug Something isn't working label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant