Pass -+J to less to turn off the status column
With -J in $LESS, less draws a status column two characters wide on the left, so lines that bat already wrapped to the terminal width wrap a second time and the rest of them ends up over the line numbers. Reset the option with -+J next to the other default less arguments and skip it for BusyBox less like -K, since it does not support it either. +J does not work here, less runs it as the J command on startup. Closes #2497
This commit is contained in:
1 parent
fcaf1acdc8
commit
daa163bc7d
5 files changed
+28
-1
No files matched your search
@@ -155,6 +155,13 @@ impl OutputType {
|
||||
p.arg("-K"); // Short version of '--quit-on-intr'
|
||||
}
|
||||
|
||||
// The status column ('-J', e.g. from $LESS) takes two columns away from
|
||||
// lines that bat already wrapped to the terminal width, so turn it off.
|
||||
// The BusyBox version of less does not support '-+'.
|
||||
if less_version != Some(LessVersion::BusyBox) {
|
||||
p.arg("-+J"); // Resets '--status-column' to its default
|
||||
}
|
||||
|
||||
// Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
|
||||
// versions of 'less'. Unfortunately, it also breaks mouse-wheel support.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user