Fix character selection

This commit is contained in:
Conrad Irwin 2023-10-24 09:31:39 +02:00
parent 6e4e19d8fc
commit 0e035c1a95
3 changed files with 7 additions and 6 deletions

View file

@ -707,7 +707,9 @@ mod tests {
let (snapshot, display_points) = marked_display_snapshot(marked_text, cx); let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
assert_eq!( assert_eq!(
surrounding_word(&snapshot, display_points[1]), surrounding_word(&snapshot, display_points[1]),
display_points[0]..display_points[2] display_points[0]..display_points[2],
"{}",
marked_text.to_string()
); );
} }
@ -717,7 +719,7 @@ mod tests {
assert("loremˇ ˇ ˇipsum", cx); assert("loremˇ ˇ ˇipsum", cx);
assert("lorem\nˇˇˇ\nipsum", cx); assert("lorem\nˇˇˇ\nipsum", cx);
assert("lorem\nˇˇipsumˇ", cx); assert("lorem\nˇˇipsumˇ", cx);
assert("lorem,ˇˇ ˇipsum", cx); assert("loremˇ,ˇˇ ipsum", cx);
assert("ˇloremˇˇ, ipsum", cx); assert("ˇloremˇˇ, ipsum", cx);
} }

View file

@ -373,8 +373,8 @@ pub(crate) struct DiagnosticEndpoint {
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Debug)] #[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Debug)]
pub enum CharKind { pub enum CharKind {
Punctuation,
Whitespace, Whitespace,
Punctuation,
Word, Word,
} }

View file

@ -748,11 +748,10 @@ async fn test_select_all_issue_2170(cx: &mut gpui::TestAppContext) {
Mode::Normal, Mode::Normal,
); );
cx.simulate_keystrokes(["g", "a"]); cx.simulate_keystrokes(["g", "a"]);
// TODO: this would be better if it selected the [ not the space.
cx.assert_state( cx.assert_state(
indoc! {" indoc! {"
defmodule« ˇ»Test« ˇ»do defmodule Test do
« ˇ»def« ˇ»test(a,« ˇ»[_,« ˇ»_]« ˇ»=« ˇ»b),« ˇ»do:« ˇ»IO.puts('hi') def test(a, «[ˇ»_, _] = b), do: IO.puts('hi')
end end
"}, "},
Mode::Visual, Mode::Visual,