Merge branch 'main' into language-api-docs
This commit is contained in:
commit
b65cf6d2d9
382 changed files with 12764 additions and 7823 deletions
|
@ -1,4 +1,4 @@
|
|||
use editor::scroll::autoscroll::Autoscroll;
|
||||
use editor::scroll::Autoscroll;
|
||||
use gpui::ViewContext;
|
||||
use language::{Bias, Point};
|
||||
use workspace::Workspace;
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
use crate::{motion::Motion, object::Object, state::Mode, utils::copy_selections_content, Vim};
|
||||
use crate::{
|
||||
motion::Motion,
|
||||
object::Object,
|
||||
state::Mode,
|
||||
utils::{coerce_punctuation, copy_selections_content},
|
||||
Vim,
|
||||
};
|
||||
use editor::{
|
||||
char_kind,
|
||||
display_map::DisplaySnapshot,
|
||||
movement::{self, FindRange, TextLayoutDetails},
|
||||
scroll::autoscroll::Autoscroll,
|
||||
CharKind, DisplayPoint,
|
||||
scroll::Autoscroll,
|
||||
DisplayPoint,
|
||||
};
|
||||
use gpui::WindowContext;
|
||||
use language::Selection;
|
||||
use language::{char_kind, CharKind, Selection};
|
||||
|
||||
pub fn change_motion(vim: &mut Vim, motion: Motion, times: Option<usize>, cx: &mut WindowContext) {
|
||||
// Some motions ignore failure when switching to normal mode
|
||||
|
@ -103,9 +108,9 @@ fn expand_changed_word_selection(
|
|||
if in_word {
|
||||
selection.end =
|
||||
movement::find_boundary(map, selection.end, FindRange::MultiLine, |left, right| {
|
||||
let left_kind = char_kind(&scope, left).coerce_punctuation(ignore_punctuation);
|
||||
let left_kind = coerce_punctuation(char_kind(&scope, left), ignore_punctuation);
|
||||
let right_kind =
|
||||
char_kind(&scope, right).coerce_punctuation(ignore_punctuation);
|
||||
coerce_punctuation(char_kind(&scope, right), ignore_punctuation);
|
||||
|
||||
left_kind != right_kind && left_kind != CharKind::Whitespace
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{motion::Motion, object::Object, utils::copy_selections_content, Vim};
|
||||
use collections::{HashMap, HashSet};
|
||||
use editor::{display_map::ToDisplayPoint, scroll::autoscroll::Autoscroll, Bias};
|
||||
use editor::{display_map::ToDisplayPoint, scroll::Autoscroll, Bias};
|
||||
use gpui::WindowContext;
|
||||
use language::Point;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::ops::Range;
|
||||
|
||||
use editor::{scroll::autoscroll::Autoscroll, MultiBufferSnapshot, ToOffset, ToPoint};
|
||||
use editor::{scroll::Autoscroll, MultiBufferSnapshot, ToOffset, ToPoint};
|
||||
use gpui::{impl_actions, ViewContext, WindowContext};
|
||||
use language::{Bias, Point};
|
||||
use serde::Deserialize;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use std::{borrow::Cow, cmp};
|
||||
|
||||
use editor::{
|
||||
display_map::ToDisplayPoint, movement, scroll::autoscroll::Autoscroll, ClipboardSelection,
|
||||
DisplayPoint,
|
||||
display_map::ToDisplayPoint, movement, scroll::Autoscroll, ClipboardSelection, DisplayPoint,
|
||||
};
|
||||
use gpui::{impl_actions, ViewContext};
|
||||
use language::{Bias, SelectionGoal};
|
||||
|
|
|
@ -12,7 +12,7 @@ actions!(vim, [Repeat, EndRepeat]);
|
|||
|
||||
fn should_replay(action: &Box<dyn Action>) -> bool {
|
||||
// skip so that we don't leave the character palette open
|
||||
if editor::ShowCharacterPalette.partial_eq(&**action) {
|
||||
if editor::actions::ShowCharacterPalette.partial_eq(&**action) {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
|
@ -152,7 +152,7 @@ pub(crate) fn repeat(cx: &mut WindowContext, from_insert_mode: bool) {
|
|||
|
||||
let mut count = Vim::read(cx).workspace_state.recorded_count.unwrap_or(1);
|
||||
|
||||
// if we came from insert mode we're just doing repititions 2 onwards.
|
||||
// if we came from insert mode we're just doing repetitions 2 onwards.
|
||||
if from_insert_mode {
|
||||
count -= 1;
|
||||
new_actions[0] = actions[0].clone();
|
||||
|
@ -493,4 +493,17 @@ mod test {
|
|||
cx.simulate_keystrokes(["escape"]);
|
||||
cx.assert_state("ˇjhello\n", Mode::Normal);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_repeat_over_blur(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state("ˇhello hello hello\n").await;
|
||||
cx.simulate_shared_keystrokes(["c", "f", "o", "x", "escape"])
|
||||
.await;
|
||||
cx.assert_shared_state("ˇx hello hello\n").await;
|
||||
cx.simulate_shared_keystrokes([":", "escape"]).await;
|
||||
cx.simulate_shared_keystrokes(["."]).await;
|
||||
cx.assert_shared_state("ˇx hello\n").await;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::Vim;
|
||||
use editor::{
|
||||
display_map::ToDisplayPoint,
|
||||
scroll::{scroll_amount::ScrollAmount, VERTICAL_SCROLL_MARGIN},
|
||||
scroll::{ScrollAmount, VERTICAL_SCROLL_MARGIN},
|
||||
DisplayPoint, Editor,
|
||||
};
|
||||
use gpui::{actions, ViewContext};
|
||||
|
|
|
@ -278,7 +278,7 @@ fn parse_replace_all(query: &str) -> Replacement {
|
|||
return Replacement::default();
|
||||
}
|
||||
|
||||
let Some(delimeter) = chars.next() else {
|
||||
let Some(delimiter) = chars.next() else {
|
||||
return Replacement::default();
|
||||
};
|
||||
|
||||
|
@ -301,13 +301,13 @@ fn parse_replace_all(query: &str) -> Replacement {
|
|||
buffer.push('$')
|
||||
// unescape escaped parens
|
||||
} else if phase == 0 && c == '(' || c == ')' {
|
||||
} else if c != delimeter {
|
||||
} else if c != delimiter {
|
||||
buffer.push('\\')
|
||||
}
|
||||
buffer.push(c)
|
||||
} else if c == '\\' {
|
||||
escaped = true;
|
||||
} else if c == delimeter {
|
||||
} else if c == delimiter {
|
||||
if phase == 0 {
|
||||
buffer = &mut replacement;
|
||||
phase = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue