diff options
author | Gokul Soumya | 2021-12-23 06:26:52 +0000 |
---|---|---|
committer | Gokul Soumya | 2021-12-23 06:26:52 +0000 |
commit | c0bbadcaaf42698d102fa03f6f9267021f3efec0 (patch) | |
tree | 4ce51151dea4ff0fe58d53ea6a5a94b58332bfc6 /helix-view | |
parent | d4fb1d06333315a3c6e9dc7f0ad8055d91551e3a (diff) |
Manually draw all block cursors
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/editor.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index fff4792d..d65c1fb2 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -116,6 +116,12 @@ pub struct Config { #[derive(Debug, Clone, PartialEq)] pub struct CursorShapeConfig([CursorKind; 3]); +impl CursorShapeConfig { + pub fn from_mode(&self, mode: Mode) -> CursorKind { + self.get(mode as usize).copied().unwrap_or_default() + } +} + impl<'de> Deserialize<'de> for CursorShapeConfig { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where @@ -647,12 +653,7 @@ impl Editor { let inner = view.inner_area(); pos.col += inner.x as usize; pos.row += inner.y as usize; - let cursorkind = self - .config - .cursor_shape - .get(doc.mode() as usize) - .copied() - .unwrap_or_default(); + let cursorkind = self.config.cursor_shape.from_mode(doc.mode()); (Some(pos), cursorkind) } else { (None, CursorKind::default()) |