editor: Refactor EditorMode::Full (#28546)

This PR lightly refactors the `EditorMode::Full` exposing two new
methods: `is_full` and `set_mode`.

Motivation is to expose fields that modify the behavior when the editor
is in `Full` mode. By using is `mode.is_full()` instead of
`EditorMode::Full` we can introduce new fields without breaking other
places in the code.

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
Danilo Leal
2025-04-10 23:22:27 +00:00
committed by GitHub
co-authored by Bennet Bo Fenner
parent 294a1b63c0
commit a2a3d1a4bd
13 changed files with 75 additions and 61 deletions
+1 -1
View File
@@ -1729,7 +1729,7 @@ async fn test_folded_multibuffer_excerpts(cx: &mut gpui::TestAppContext) {
],
cx,
);
let mut editor = Editor::new(EditorMode::Full, multi_buffer.clone(), None, window, cx);
let mut editor = Editor::new(EditorMode::full(), multi_buffer.clone(), None, window, cx);
let buffer_ids = multi_buffer.read(cx).excerpt_buffer_ids();
// fold all but the second buffer, so that we test navigating between two
+2 -2
View File
@@ -22,7 +22,7 @@ mod visual;
use anyhow::Result;
use collections::HashMap;
use editor::{
Anchor, Bias, Editor, EditorEvent, EditorMode, EditorSettings, HideMouseCursorOrigin, ToPoint,
Anchor, Bias, Editor, EditorEvent, EditorSettings, HideMouseCursorOrigin, ToPoint,
movement::{self, FindRange},
};
use gpui::{
@@ -1127,7 +1127,7 @@ impl Vim {
let editor = editor.read(cx);
let editor_mode = editor.mode();
if editor_mode == EditorMode::Full
if editor_mode.is_full()
&& !newest_selection_empty
&& self.mode == Mode::Normal
// When following someone, don't switch vim mode.