diff options
author | Quentin | 2024-03-25 01:29:36 +0000 |
---|---|---|
committer | GitHub | 2024-03-25 01:29:36 +0000 |
commit | 614a744d24e54225eae2ad0d27719b81c0cf9a4d (patch) | |
tree | d7d70ed5ffa7d883ddc6c9d2ac96ac5c8e4fa1dc /helix-term/src | |
parent | 2d9e336f640cccdd347e35289c3e4c0371777a3f (diff) |
Add narrow no-break space support (#9604)
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/document.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs index dc61ca2e..b571b83c 100644 --- a/helix-term/src/ui/document.rs +++ b/helix-term/src/ui/document.rs @@ -341,6 +341,7 @@ pub struct TextRenderer<'a> { pub indent_guide_style: Style, pub newline: String, pub nbsp: String, + pub nnbsp: String, pub space: String, pub tab: String, pub virtual_tab: String, @@ -395,6 +396,11 @@ impl<'a> TextRenderer<'a> { } else { " ".to_owned() }; + let nnbsp = if ws_render.nnbsp() == WhitespaceRenderValue::All { + ws_chars.nnbsp.into() + } else { + " ".to_owned() + }; let text_style = theme.get("ui.text"); @@ -405,6 +411,7 @@ impl<'a> TextRenderer<'a> { indent_guide_char: editor_config.indent_guides.character.into(), newline, nbsp, + nnbsp, space, tab, virtual_tab, @@ -448,6 +455,7 @@ impl<'a> TextRenderer<'a> { let width = grapheme.width(); let space = if is_virtual { " " } else { &self.space }; let nbsp = if is_virtual { " " } else { &self.nbsp }; + let nnbsp = if is_virtual { " " } else { &self.nnbsp }; let tab = if is_virtual { &self.virtual_tab } else { @@ -461,6 +469,7 @@ impl<'a> TextRenderer<'a> { // TODO special rendering for other whitespaces? Grapheme::Other { ref g } if g == " " => space, Grapheme::Other { ref g } if g == "\u{00A0}" => nbsp, + Grapheme::Other { ref g } if g == "\u{202F}" => nnbsp, Grapheme::Other { ref g } => g, Grapheme::Newline => &self.newline, }; |