What version of bat are you using?
bat 0.15.4
Describe the bug you encountered:
I have a file with long lines (longer than 100 characters). If I call bat like this, lines are wrapping:
bat --wrap=never Vagrantfile
Describe what you expected to happen?
I expect the lines not to wrap.
How did you install bat?
On Ubuntu, I used the DEB package provided in the GitHub releases. On macOS, I used Homebrew.
The following system information is for Ubuntu, but I see the same behavior on macOS Catalina as well.
$ uname -srm
Linux 5.4.0-47-generic x86_64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
$ bat --version
bat 0.15.4
$ env
No wrapper script for 'bat'.
No wrapper function for 'bat'.
$ /usr/bin/fish --login -i -c functions cat
# Defined in - @ line 1
function cat --wraps=bat --description 'alias cat=bat'
bat $argv;
end
$ less --version
less 551 (GNU regular expressions)
If I call
batlike this, lines are wrapping
Well, the lines will still be wrapped by your terminal emulator (or the pager). But you shouldn't see a continued line in the sidebar:

Oh... now I understand. Could it be possible to set the -S option to less if the following conditions are met?
--pager--wrap=neverIf I try this, it seems to do what I expect it to do:
bat --wrap=never --pager="less -SR" a.txt
That sounds like a nice feature request actually. @eth-p: what do you think?
Can I work on this?
That sounds like a nice feature request actually. @eth-p: what do you think?
Sounds useful.
I'm concerned making the change might be disruptive for people who set --wrap=never in their config file without --pager, though.
But at the same time, I'm also not a fan of adding --wrap=absolutely-never... Maybe try it as a default, but be open to making it opt-in if we get enough bug report issues about it in the next release?
But at the same time, I'm also not a fan of adding
--wrap=absolutely-never... Maybe try it as a default, but be open to making it opt-in if we get enough bug report issues about it in the next release?
Good idea, yes.
@gahag: Can I work on this?
Yes, please! :smile:
Be warned though: we have to deal with multiple versions of less on the user side. This has been problematic in the past. If we make changes to the command-line options that are passed to less, I would like to see the new feature tested with a number of different less versions (at least 487, 551 and the latest version. You can get a bigger picture by searching through some of the recent bug reports where people often post their less version).
@sharkdp thanks for the heads up. Is there an existing method or tool for testing with many less versions, or that would have to be improvised?
We don't have an automated way of doing that yet, unfortunately. We'll have to find someone with the respective version of less or install these versions ourselves. I do have access to 487 and 551 - on Linux. We also had problems with bugs in less on Windows :-/
I have access to Arch Linux and FreeBSD machines, where the less versions are 551 and 530. Also, I just noted that a Debian docker image has the 487 version. I would be willing to implement this feature and test against these versions, is that ok? Also, is 551 the latest version?
I would be willing to implement this feature and test against these versions, is that ok?
Yes - of course.
Also, is 551 the latest version?
I don't think it is, no.
Ok. I'll have a go at it tomorrow, hope it will be done by the middle of the day.
Most helpful comment
That sounds like a nice feature request actually. @eth-p: what do you think?