Vim visual block mode
This isn't quite an exact emulation, as instead of using one selection that is magically in "column mode", we emulate it with a bunch of zed multi-selections (one per line). I think this is better, as it requires fewer changes to the codebase, and lets you see the impact of any changes immediately on all lines. Fixes: zed-industries/community#984
This commit is contained in:
parent
1cc0798aea
commit
1b4dd49b1d
9 changed files with 518 additions and 135 deletions
|
@ -160,7 +160,7 @@ impl<'a> NeovimBackedTestContext<'a> {
|
|||
pub async fn neovim_state(&mut self) -> String {
|
||||
generate_marked_text(
|
||||
self.neovim.text().await.as_str(),
|
||||
&vec![self.neovim_selection().await],
|
||||
&self.neovim_selections().await[..],
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
@ -169,9 +169,12 @@ impl<'a> NeovimBackedTestContext<'a> {
|
|||
self.neovim.mode().await.unwrap()
|
||||
}
|
||||
|
||||
async fn neovim_selection(&mut self) -> Range<usize> {
|
||||
let neovim_selection = self.neovim.selection().await;
|
||||
neovim_selection.to_offset(&self.buffer_snapshot())
|
||||
async fn neovim_selections(&mut self) -> Vec<Range<usize>> {
|
||||
let neovim_selections = self.neovim.selections().await;
|
||||
neovim_selections
|
||||
.into_iter()
|
||||
.map(|selection| selection.to_offset(&self.buffer_snapshot()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub async fn assert_state_matches(&mut self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue