editor: Hide mouse cursor also for movements and selections (#27677)

This enables hiding mouse cursor even on cursor movements like up, down,
etc. or selections made using keyboard, etc.

Renamed existing boolean setting "hide_mouse_while_typing" to
"hide_mouse". It can have three values: `on_typing_and_movement`,
`on_typing`, `never`.

Release Notes:

- Now mouse cursor hides even when you navigate, or make selections
using keyboard in editor. This behavior can be changed by setting
`hide_mouse` to `on_typing_and_movement`, `on_typing` or `never`.
This commit is contained in:
Smit Barmase
2025-03-29 19:23:36 +05:30
committed by GitHub
parent 7fe6188f8e
commit 4970fe2d56
8 changed files with 264 additions and 44 deletions
+19 -4
View File
@@ -39,7 +39,7 @@ pub struct EditorSettings {
#[serde(default)]
pub go_to_definition_fallback: GoToDefinitionFallback,
pub jupyter: Jupyter,
pub hide_mouse_while_typing: Option<bool>,
pub hide_mouse: Option<HideMouseMode>,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
@@ -225,6 +225,21 @@ pub enum GoToDefinitionFallback {
FindAllReferences,
}
/// Determines when the mouse cursor should be hidden in an editor or input box.
///
/// Default: on_typing_and_movement
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum HideMouseMode {
/// Never hide the mouse cursor
Never,
/// Hide only when typing
OnTyping,
/// Hide on both typing and cursor movement
#[default]
OnTypingAndMovement,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
pub struct EditorSettingsContent {
/// Whether the cursor blinks in the editor.
@@ -236,10 +251,10 @@ pub struct EditorSettingsContent {
///
/// Default: None
pub cursor_shape: Option<CursorShape>,
/// Determines whether the mouse cursor should be hidden while typing in an editor or input box.
/// Determines when the mouse cursor should be hidden in an editor or input box.
///
/// Default: true
pub hide_mouse_while_typing: Option<bool>,
/// Default: on_typing_and_movement
pub hide_mouse: Option<HideMouseMode>,
/// How to highlight the current line in the editor.
///
/// Default: all