diff --git a/assets/syntaxes/show-nonprintable.sublime-syntax b/assets/syntaxes/show-nonprintable.sublime-syntax index 6e90e19e..c0cb0ba1 100644 --- a/assets/syntaxes/show-nonprintable.sublime-syntax +++ b/assets/syntaxes/show-nonprintable.sublime-syntax @@ -11,6 +11,8 @@ contexts: scope: support.function.show-nonprintable.space - match: "├─*┤" scope: constant.character.escape.show-nonprintable.tab + - match: "↹" + scope: constant.character.escape.show-nonprintable.tab - match: "␤" scope: keyword.operator.show-nonprintable.newline - match: "␍" diff --git a/src/preprocessor.rs b/src/preprocessor.rs index a69f453e..aae9537c 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -36,13 +36,7 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String { pub fn replace_nonprintable(input: &mut Vec, output: &mut Vec, tab_width: usize) { output.clear(); - let tab_width = if tab_width == 0 { - 4 - } else if tab_width == 1 { - 2 - } else { - tab_width - }; + let tab_width = if tab_width == 0 { 4 } else { tab_width }; for chr in input { match *chr { @@ -50,9 +44,13 @@ pub fn replace_nonprintable(input: &mut Vec, output: &mut Vec, tab_width b' ' => output.extend_from_slice("•".as_bytes()), // tab b'\t' => { - output.extend_from_slice("├".as_bytes()); - output.extend_from_slice("─".repeat(tab_width - 2).as_bytes()); - output.extend_from_slice("┤".as_bytes()); + if tab_width == 1 { + output.extend_from_slice("↹".as_bytes()); + } else { + output.extend_from_slice("├".as_bytes()); + output.extend_from_slice("─".repeat(tab_width - 2).as_bytes()); + output.extend_from_slice("┤".as_bytes()); + } } // new line b'\n' => output.extend_from_slice("␤".as_bytes()),