Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

helix: Always offset cursor on selection (#46311)

Josh Robson Chase81da953acfdc
diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs
index 69b2816cc0b..4e71a698ff0 100644
--- a/crates/vim/src/state.rs
+++ b/crates/vim/src/state.rs
@@ -73,6 +73,10 @@ impl Mode {
Self::Normal | Self::Insert | Self::Replace | Self::HelixNormal => false,
}
}
+
+ pub fn is_helix(&self) -> bool {
+ matches!(self, Self::HelixNormal | Self::HelixSelect)
+ }
}
#[derive(Clone, Debug, PartialEq)]
diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs
index 8c551bcd276..3085dc5b376 100644
--- a/crates/vim/src/vim.rs
+++ b/crates/vim/src/vim.rs
@@ -2070,7 +2070,7 @@ impl Vim {
input_enabled: self.editor_input_enabled(),
expects_character_input: self.expects_character_input(),
autoindent: self.should_autoindent(),
- cursor_offset_on_selection: self.mode.is_visual(),
+ cursor_offset_on_selection: self.mode.is_visual() || self.mode.is_helix(),
line_mode: matches!(self.mode, Mode::VisualLine),
hide_edit_predictions: !matches!(self.mode, Mode::Insert | Mode::Replace),
}