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 20:22:27 -03:00 committed by GitHub
parent 294a1b63c0
commit a2a3d1a4bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 75 additions and 61 deletions

View file

@ -18,7 +18,7 @@ use anyhow::Context as _;
use collections::{BTreeSet, HashMap, HashSet, hash_map};
use db::kvp::KEY_VALUE_STORE;
use editor::{
AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorMode, EditorSettings, ExcerptId,
AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorSettings, ExcerptId,
ExcerptRange, MultiBufferSnapshot, RangeToAnchorExt, ShowScrollbar,
display_map::ToDisplayPoint,
items::{entry_git_aware_label_color, entry_label_color},
@ -4725,7 +4725,7 @@ fn workspace_active_editor(
let active_item = workspace.active_item(cx)?;
let active_editor = active_item
.act_as::<Editor>(cx)
.filter(|editor| editor.read(cx).mode() == EditorMode::Full)?;
.filter(|editor| editor.read(cx).mode().is_full())?;
Some((active_item, active_editor))
}