-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Erratic output when OSC8 sequences are present #2541
Description
Hello -
When bat displays something that already includes an OSC8 sequence, it has erratic output, dependent on the terminal-width. Seemingly, OSC8 ids and urls are included in line-wrapping which leads to strange output depending on where the line is cut.
What steps will reproduce the bug?
Works as expected:
echo '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n' | bat --terminal-width=64Includes escape characters in output:
echo '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n' | bat --terminal-width=48No escape characters, but incorrect wrapping:
echo '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n' | bat --terminal-width=40What happens?
If you keep changing the terminal width, strange things keep happening.
What did you expect to happen instead?
The output should be the same in all above scenarios, as long as terminal-width is greater than the length of the printable section of an OSC8 sequence ("This is a link") in this case.
How did you install bat?
sudo pacman -S batbat version and environment
Software version
bat 0.23.0 (871abd2)
Operating system
Linux 6.2.10-arch1-1
Command-line
bat --terminal-width=24 --diagnostic Environment variables
SHELL=/usr/bin/zsh
PAGER=<not set>
LESS=<not set>
LANG=en_US.UTF-8
LC_ALL=<not set>
BAT_PAGER=<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=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
Could not read contents of '/home/tim/.config/bat/config': No such file or directory (os error 2).
Custom assets metadata
Could not read contents of '/home/tim/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'/home/tim/.cache/bat' not found
Compile time information
- Profile: release
- Target triple: x86_64-unknown-linux-gnu
- 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 608 (PCRE2 regular expressions)
Copyright (C) 1984-2022 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