feat: configure cursor appearance by editing mode

This commit is contained in:
2026-10-26 15:01:19 +01:00
parent 846803a3e2
commit ce434a1c17
13 changed files with 356 additions and 51 deletions
+63
View File
@@ -653,6 +653,69 @@ fn git_gutter_config_modes_default_and_rejection() {
}
}
#[test]
fn cursor_config_partial_shapes_and_invalid_options() {
use crate::cursor::CursorShape::{Bar, Block, Underline};
let fixture = Fixture::new();
for (options, mode_colors, shapes) in [
(
r#"{ insert: :bar, "visual" => "underline" }"#,
true,
[Block, Bar, Block, Block, Underline],
),
(
r#"{ mode_colors: false, normal: "bar", insert: :underline, command: :bar, search: "underline", visual: :block }"#,
false,
[Bar, Underline, Bar, Underline, Block],
),
(
r#"{ "mode_colors" => true, normal: :underline, insert: "block", command: "underline", search: :bar, visual: "bar" }"#,
true,
[Underline, Block, Underline, Bar, Bar],
),
] {
let path = fixture.file(
"config.rb",
&format!("Vamp.configure {{ |config| config.cursor = {options} }}"),
);
let cursor = load_config(&path).unwrap().cursor;
assert_eq!(cursor.mode_colors, mode_colors);
assert_eq!(
[
cursor.normal,
cursor.insert,
cursor.command,
cursor.search,
cursor.visual
],
shapes
);
}
for options in [
"nil",
"false",
"[]",
"{ mode_colors: nil }",
"{ mode_colors: 1 }",
r#"{ mode_colors: "true" }"#,
"{ insert: nil }",
"{ insert: false }",
"{ insert: 1 }",
"{ insert: :beam }",
r#"{ normal: "" }"#,
"{ unknown: :block }",
"{ 1 => :block }",
r#"{ insert: :bar, "insert" => :block }"#,
] {
let path = fixture.file(
"config.rb",
&format!("Vamp.configure {{ |config| config.cursor = {options} }}"),
);
assert!(load_config(&path).is_err(), "{options}");
}
}
#[test]
fn git_blame_boolean_config_typed_toggle_palette_and_wire_validation() {
let fixture = Fixture::new();