Fix backwards mouse selection in vim mode (#11329)
Fixes: #8492 Release Notes: - vim: Fixed last character of reversed mouse selections (#8492)
This commit is contained in:
parent
ff56ca7280
commit
610968815c
4 changed files with 87 additions and 29 deletions
|
@ -8,7 +8,7 @@ use std::time::Duration;
|
|||
use command_palette::CommandPalette;
|
||||
use editor::DisplayPoint;
|
||||
use futures::StreamExt;
|
||||
use gpui::KeyBinding;
|
||||
use gpui::{KeyBinding, Modifiers, MouseButton, TestAppContext};
|
||||
pub use neovim_backed_binding_test_context::*;
|
||||
pub use neovim_backed_test_context::*;
|
||||
pub use vim_test_context::*;
|
||||
|
@ -1057,3 +1057,19 @@ async fn test_undo(cx: &mut gpui::TestAppContext) {
|
|||
3"})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_mouse_selection(cx: &mut TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
|
||||
cx.set_state("ˇone two three", Mode::Normal);
|
||||
|
||||
let start_point = cx.pixel_position("one twˇo three");
|
||||
let end_point = cx.pixel_position("one ˇtwo three");
|
||||
|
||||
cx.simulate_mouse_down(start_point, MouseButton::Left, Modifiers::none());
|
||||
cx.simulate_mouse_move(end_point, MouseButton::Left, Modifiers::none());
|
||||
cx.simulate_mouse_up(end_point, MouseButton::Left, Modifiers::none());
|
||||
|
||||
cx.assert_state("one «ˇtwo» three", Mode::Visual)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue