From 614a744d24e54225eae2ad0d27719b81c0cf9a4d Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 25 Mar 2024 02:29:36 +0100 Subject: Add narrow no-break space support (#9604) --- helix-view/src/editor.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 3c530c4e..dd360a78 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -702,6 +702,7 @@ pub enum WhitespaceRender { default: Option, space: Option, nbsp: Option, + nnbsp: Option, tab: Option, newline: Option, }, @@ -733,6 +734,14 @@ impl WhitespaceRender { } } } + pub fn nnbsp(&self) -> WhitespaceRenderValue { + match *self { + Self::Basic(val) => val, + Self::Specific { default, nnbsp, .. } => { + nnbsp.or(default).unwrap_or(WhitespaceRenderValue::None) + } + } + } pub fn tab(&self) -> WhitespaceRenderValue { match *self { Self::Basic(val) => val, @@ -756,6 +765,7 @@ impl WhitespaceRender { pub struct WhitespaceCharacters { pub space: char, pub nbsp: char, + pub nnbsp: char, pub tab: char, pub tabpad: char, pub newline: char, @@ -766,6 +776,7 @@ impl Default for WhitespaceCharacters { Self { space: '·', // U+00B7 nbsp: '⍽', // U+237D + nnbsp: '␣', // U+2423 tab: '→', // U+2192 newline: '⏎', // U+23CE tabpad: ' ', -- cgit v1.2.3-70-g09d2