Add cursor_shape setting for the default editor (#17572)

Closes https://github.com/zed-industries/zed/issues/16451,
https://github.com/zed-industries/zed/issues/14447,
https://github.com/zed-industries/zed/issues/7203

Addresses but does not closes
https://github.com/zed-industries/zed/issues/5179

Expose cursor shape selection to users. Possibly controversial, since
block cursor seems preserved for vim and terminal. But the heart wants
what it wants?

Release Notes:

- Added a setting for `cursor_shape`. Can be `bar`, `block`,
`underline`, or `hollow`. Default is `bar`.
This commit is contained in:
thataboy
2024-09-16 21:01:43 -06:00
committed by GitHub
parent d315405be1
commit a141415bd3
5 changed files with 57 additions and 2 deletions
+2 -1
View File
@@ -1904,7 +1904,7 @@ impl Editor {
linked_editing_range_task: Default::default(),
pending_rename: Default::default(),
searchable: true,
cursor_shape: Default::default(),
cursor_shape: EditorSettings::get_global(cx).cursor_shape,
current_line_highlight: None,
autoindent_mode: Some(AutoindentMode::EachLine),
collapse_matches: false,
@@ -11820,6 +11820,7 @@ impl Editor {
cx,
);
let editor_settings = EditorSettings::get_global(cx);
self.cursor_shape = editor_settings.cursor_shape;
self.scroll_manager.vertical_scroll_margin = editor_settings.vertical_scroll_margin;
self.show_breadcrumbs = editor_settings.toolbar.breadcrumbs;
+7
View File
@@ -1,4 +1,5 @@
use gpui::AppContext;
use language::CursorShape;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources};
@@ -6,6 +7,7 @@ use settings::{Settings, SettingsSources};
#[derive(Deserialize, Clone)]
pub struct EditorSettings {
pub cursor_blink: bool,
pub cursor_shape: CursorShape,
pub current_line_highlight: CurrentLineHighlight,
pub hover_popover_enabled: bool,
pub show_completions_on_input: bool,
@@ -177,6 +179,11 @@ pub struct EditorSettingsContent {
///
/// Default: true
pub cursor_blink: Option<bool>,
/// Cursor shape for the default editor.
/// Can be "bar", "block", "underscore", or "hollow".
///
/// Default: bar
pub cursor_shape: Option<CursorShape>,
/// How to highlight the current line in the editor.
///
/// Default: all