Fix some bugs with vim objects
- softwrap interaction - correct selection if cursor is on opening marker
This commit is contained in:
parent
ef1a69156d
commit
9589f5573d
12 changed files with 2323 additions and 142 deletions
|
@ -1,15 +1,12 @@
|
|||
use editor::scroll::VERTICAL_SCROLL_MARGIN;
|
||||
use indoc::indoc;
|
||||
use settings::SettingsStore;
|
||||
use std::ops::{Deref, DerefMut, Range};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use collections::{HashMap, HashSet};
|
||||
use gpui::{geometry::vector::vec2f, ContextHandle};
|
||||
use language::{
|
||||
language_settings::{AllLanguageSettings, SoftWrap},
|
||||
OffsetRangeExt,
|
||||
};
|
||||
use util::test::{generate_marked_text, marked_text_offsets};
|
||||
use language::language_settings::{AllLanguageSettings, SoftWrap};
|
||||
use util::test::marked_text_offsets;
|
||||
|
||||
use super::{neovim_connection::NeovimConnection, NeovimBackedBindingTestContext, VimTestContext};
|
||||
use crate::state::Mode;
|
||||
|
@ -37,8 +34,6 @@ pub enum ExemptionFeatures {
|
|||
AroundSentenceStartingBetweenIncludesWrongWhitespace,
|
||||
// Non empty selection with text objects in visual mode
|
||||
NonEmptyVisualTextObjects,
|
||||
// Quote style surrounding text objects don't seek forward properly
|
||||
QuotesSeekForward,
|
||||
// Neovim freezes up for some reason with angle brackets
|
||||
AngleBracketsFreezeNeovim,
|
||||
// Sentence Doesn't backtrack when its at the end of the file
|
||||
|
@ -250,25 +245,13 @@ impl<'a> NeovimBackedTestContext<'a> {
|
|||
}
|
||||
|
||||
pub async fn neovim_state(&mut self) -> String {
|
||||
generate_marked_text(
|
||||
self.neovim.text().await.as_str(),
|
||||
&self.neovim_selections().await[..],
|
||||
true,
|
||||
)
|
||||
self.neovim.marked_text().await
|
||||
}
|
||||
|
||||
pub async fn neovim_mode(&mut self) -> Mode {
|
||||
self.neovim.mode().await.unwrap()
|
||||
}
|
||||
|
||||
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) {
|
||||
self.is_dirty = false;
|
||||
let neovim = self.neovim_state().await;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue