mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-31 10:11:07 +00:00
correctly handle multiple tabs in one line
This commit is contained in:
parent
67124f8513
commit
e7df748b6d
@ -66,6 +66,7 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
|||||||
// tab
|
// tab
|
||||||
'\t' => {
|
'\t' => {
|
||||||
let tab_stop = tab_width - ((line_idx - 1) % tab_width);
|
let tab_stop = tab_width - ((line_idx - 1) % tab_width);
|
||||||
|
line_idx = 0;
|
||||||
if tab_stop == 1 {
|
if tab_stop == 1 {
|
||||||
output.push('↹');
|
output.push('↹');
|
||||||
} else {
|
} else {
|
||||||
|
@ -1227,7 +1227,7 @@ fn show_all_tabstops() {
|
|||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
.stdout(
|
.stdout(
|
||||||
"├──┤1├┤2├──┤3├┤4␊
|
"├──┤1├─┤2├─┤3├─┤4␊
|
||||||
1├─┤?␊
|
1├─┤?␊
|
||||||
22├┤?␊
|
22├┤?␊
|
||||||
333↹?␊
|
333↹?␊
|
||||||
@ -1250,7 +1250,7 @@ fn show_all_tabstops_long() {
|
|||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
.stdout(
|
.stdout(
|
||||||
"├──────┤1├────┤2├──┤3├┤4␊
|
"├──────┤1├─────┤2├─────┤3├─────┤4␊
|
||||||
1├─────┤?␊
|
1├─────┤?␊
|
||||||
22├────┤?␊
|
22├────┤?␊
|
||||||
333├───┤?␊
|
333├───┤?␊
|
||||||
|
Loading…
x
Reference in New Issue
Block a user