id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_506400 | rust_dataset.txt | 506,400 | 512 | shift-r");
cx.assert_state("«xˇ»z", Mode::HelixNormal);
}
#[gpui::test]
async fn test_helix_select_mode(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
assert_eq!(cx.mode(), Mode::Normal);
cx.enable_helix();
cx.simulate_keystroke... |
rust_dataset_chunk_506401 | rust_dataset.txt | 506,401 | 512 | }
#[gpui::test]
async fn test_helix_select_trailing_newline(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.set_state("line one\nline two\nline threeˇ\n", Mode::HelixNormal);
cx.simulate_keystrokes("v");
cx.asser... |
rust_dataset_chunk_506402 | rust_dataset.txt | 506,402 | 512 | ",
Mode::HelixNormal,
);
cx.simulate_keystrokes("2 x");
cx.assert_state(
"line one\n«line two\nline three\nˇ»line four",
Mode::HelixNormal,
);
// Test extending existing line selection
cx.set_state(
indoc! {"
li... |
rust_dataset_chunk_506403 | rust_dataset.txt | 506,403 | 512 | (
indoc! {"
«non-empty line
ˇ»line two
line three"},
Mode::HelixNormal,
);
// Same test but with empty line - should select one extra
cx.set_state(
indoc! {"
ˇ
line two
line three"},
... |
rust_dataset_chunk_506404 | rust_dataset.txt | 506,404 | 512 | ::HelixNormal,
);
cx.set_state("oneˇ\ntwo\nthree", Mode::HelixNormal);
cx.simulate_keystrokes("d u x");
cx.assert_state("«one\nˇ»two\nthree", Mode::HelixNormal);
}
#[gpui::test]
async fn test_helix_insert_before_after_select_lines(cx: &mut gpui::TestAppContext) {
le... |
rust_dataset_chunk_506405 | rust_dataset.txt | 506,405 | 512 | �line three\nline four",
Mode::HelixNormal,
);
cx.simulate_keystrokes("v k k");
cx.assert_state(
"«ˇline one\nline two\nl»ine three\nline four",
Mode::HelixSelect,
);
cx.simulate_keystrokes("shift-o");
cx.assert_state("ˇ\nline one\nline... |
rust_dataset_chunk_506406 | rust_dataset.txt | 506,406 | 512 | The quick brown\nfox jumps over", Mode::HelixNormal);
cx.simulate_keystrokes("v g l d");
cx.assert_state("ˇ\nfox jumps over", Mode::HelixNormal);
// same from the middle of a line — the cursor rests on the trailing
// newline, matching Helix and the whole-line case above.
cx.set... |
rust_dataset_chunk_506407 | rust_dataset.txt | 506,407 | 512 | rokes("v w");
cx.assert_state("«one tˇ»wo", Mode::Visual);
cx.simulate_keystrokes("escape");
cx.assert_state("one ˇtwo", Mode::Normal);
cx.enable_helix();
cx.set_state("ˇone two", Mode::HelixNormal);
cx.simulate_keystrokes("v w");
cx.assert_state("«one ˇ»two", Mo... |
rust_dataset_chunk_506408 | rust_dataset.txt | 506,408 | 512 | ::update_global(cx, |store, cx| {
store.update_user_settings(cx, |s| {
s.vim_mode = Some(true);
s.helix_mode = Some(true);
});
});
});
let cx = cx.add_empty_window();
let editor = cx.update(|window, cx| {
... |
rust_dataset_chunk_506409 | rust_dataset.txt | 506,409 | 512 | ("s");
cx.run_until_parked();
cx.simulate_keystrokes("enter");
cx.assert_state("«oneˇ» two «oneˇ»", Mode::HelixNormal);
// TODO: change "search_in_selection" to not perform any search when in helix select mode with no selection
// cx.set_state("ˇstuff one two one", Mode::HelixNo... |
rust_dataset_chunk_506410 | rust_dataset.txt | 506,410 | 512 | ("enter");
cx.simulate_keystrokes("n n");
cx.assert_state("hello two «oneˇ» two «oneˇ» two «oneˇ»", Mode::HelixSelect);
}
#[gpui::test]
async fn test_helix_select_next_match_wrapping(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable... |
rust_dataset_chunk_506411 | rust_dataset.txt | 506,411 | 512 | _keystrokes("enter");
cx.simulate_keystrokes("v");
cx.simulate_keystrokes("n");
cx.simulate_keystrokes("n");
// Should not panic when wrapping past last match.
cx.assert_state(
indoc! {"
search «termˇ»
stuff
search «term... |
rust_dataset_chunk_506412 | rust_dataset.txt | 506,412 | 512 | VimTestContext::new(cx, true).await;
cx.set_state("ˇone two", Mode::HelixNormal);
cx.simulate_keystrokes("c");
cx.assert_state("ˇne two", Mode::Insert);
cx.set_state("«oneˇ» two", Mode::HelixNormal);
cx.simulate_keystrokes("c");
cx.assert_state("ˇ two", Mode::Insert);
... |
rust_dataset_chunk_506413 | rust_dataset.txt | 506,413 | 512 | �界", Mode::HelixNormal);
// Test with end of line
cx.set_state("endˇ", Mode::HelixNormal);
cx.simulate_keystrokes("g l");
cx.assert_state("enˇd", Mode::HelixNormal);
// Test with empty line
cx.set_state(
indoc! {"
hello
ˇ
... |
rust_dataset_chunk_506414 | rust_dataset.txt | 506,414 | 512 | gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.set_state("ˇalpha beta gamma", Mode::HelixNormal);
let overlay_counts = active_helix_jump_overlay_counts(&mut cx);
cx.simulate_keystrokes("g w");
cx.simulate_keystrokes("z");... |
rust_dataset_chunk_506415 | rust_dataset.txt | 506,415 | 512 | (&next_group.to_string());
assert_eq!(
active_helix_jump_overlay_counts(&mut cx),
initial_overlay_counts
);
assert!(
matches!(
cx.active_operator(),
Some(Operator::HelixJump {
first_char: Some(ch),
... |
rust_dataset_chunk_506416 | rust_dataset.txt | 506,416 | 512 | async fn test_helix_jump_at_end_of_buffer(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.set_state("alpha beta gammaˇ", Mode::HelixNormal);
jump_to_word(&mut cx, "gamma");
cx.assert_state("alpha beta «gammaˇ»", Mode::He... |
rust_dataset_chunk_506417 | rust_dataset.txt | 506,417 | 512 | let mut cx = VimTestContext::new(cx, true).await;
bind_vim_jump_to_word(&mut cx, "s");
cx.set_state("ˇone two three", Mode::Normal);
cx.simulate_keystrokes("s");
let label = helix_jump_label_for_word(&mut cx, "two");
let mut chars = label.chars();
let first = chars.next... |
rust_dataset_chunk_506418 | rust_dataset.txt | 506,418 | 512 | }
#[gpui::test]
async fn test_vim_visual_jump_extends_selection(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
bind_vim_jump_to_word(&mut cx, "g z");
cx.set_state("one «twoˇ» three four", Mode::Visual);
jump_to_word_with_keystrokes(&mut c... |
rust_dataset_chunk_506419 | rust_dataset.txt | 506,419 | 512 | _extends_reversed_selection_backward(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.set_state("one two «ˇthree» four", Mode::HelixSelect);
jump_to_word(&mut cx, "one");
cx.assert_state("«ˇone two three» four", Mode::Heli... |
rust_dataset_chunk_506420 | rust_dataset.txt | 506,420 | 512 | ![
("aa".to_string(), "eee".to_string()),
("ab".to_string(), "ccc".to_string()),
("ac".to_string(), "fff".to_string()),
("ad".to_string(), "bbb".to_string()),
("ae".to_string(), "ggg".to_string()),
("af".to_string(), "aaa".t... |
rust_dataset_chunk_506421 | rust_dataset.txt | 506,421 | 512 | .text_system(),
font,
font_size,
);
data.overlays
.into_iter()
.map(|overlay| overlay.label.text_color)
.collect::<Vec<_>>()
});
assert!(!label_colors.is_empty());
assert!(
label... |
rust_dataset_chunk_506422 | rust_dataset.txt | 506,422 | 512 | test(fs.clone(), [path!("/dir").as_ref()], cx).await;
let window_handle =
cx.add_window(|window, cx| MultiWorkspace::test_new(project.clone(), window, cx));
let workspace = window_handle
.read_with(cx, |mw, _| mw.workspace().clone())
.unwrap();
cx.update(|cx|... |
rust_dataset_chunk_506423 | rust_dataset.txt | 506,423 | 512 | indoc! {"
line one
line two
line three
line four
line «ˇfive»"},
Mode::HelixNormal,
);
// And scroll up, once again collapsing the selection.
cx.simulate_keystroke("ctrl-u");
cx.assert_state(
indoc! {"
... |
rust_dataset_chunk_506424 | rust_dataset.txt | 506,424 | 512 | );
}
#[gpui::test]
async fn test_helix_replace_uses_graphemes(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.set_state("«Hällöˇ» Wörld", Mode::HelixNormal);
cx.simulate_keystrokes("r 1");
cx.assert_state("«1... |
rust_dataset_chunk_506425 | rust_dataset.txt | 506,425 | 512 | ˇline two
line three"},
Mode::HelixNormal,
);
// a count larger than the number of lines clips to the last line
cx.set_state(
indoc! {"
line one
line two
ˇline three"},
Mode::HelixNormal,
);
c... |
rust_dataset_chunk_506426 | rust_dataset.txt | 506,426 | 512 | );
cx.simulate_keystrokes("3 shift-g");
cx.assert_state(
indoc! {"
line one
line two
ˇline three"},
Mode::HelixNormal,
);
// but not when count is missing entirely
cx.set_state(
indoc! {"
line... |
rust_dataset_chunk_506427 | rust_dataset.txt | 506,427 | 512 | Mode::HelixNormal,
);
cx.simulate_keystrokes("g e");
cx.assert_state(
indoc! {"
foo bar
ˇbaz"},
Mode::HelixNormal,
);
// a count is ignored; ge always goes to the last line
cx.set_state(
indoc! {"
... |
rust_dataset_chunk_506428 | rust_dataset.txt | 506,428 | 512 | "
one
ˇtwo
three"},
Mode::HelixNormal,
);
assert_eq!(cx.active_operator(), None);
cx.set_state(
indoc! {"
one
two
ˇthree"},
Mode::HelixNormal,
);
cx.set_head_text(indoc! {... |
rust_dataset_chunk_506429 | rust_dataset.txt | 506,429 | 512 | );
cx.simulate_keystrokes("space r");
prepare_request.next().await.unwrap();
cx.simulate_input("after");
cx.simulate_keystrokes("enter");
rename_request.next().await.unwrap();
cx.assert_state("const after = 2; console.log(afterˇ)", Mode::HelixNormal);
}
... |
rust_dataset_chunk_506430 | rust_dataset.txt | 506,430 | 512 | \nbbb\nccc\n", Mode::HelixNormal);
cx.simulate_keystrokes("x");
cx.assert_state("« aa \nˇ»bbb\nccc\n", Mode::HelixNormal);
}
#[gpui::test]
async fn test_insert_line_with_multi_keybinding_to_helix_normal(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).a... |
rust_dataset_chunk_506431 | rust_dataset.txt | 506,431 | 512 | window: &mut Window,
cx: &mut Context<Self>,
) {
self.stop_recording(cx);
self.update_editor(cx, |_, editor, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
s.move_with(&mut |map, selection| {
let Ok(Some(range)) = ... |
rust_dataset_chunk_506432 | rust_dataset.txt | 506,432 | 512 | Right);
if cursor_offset >= start_offset && cursor_offset <= end_offset {
Some(range)
} else {
None
}
}
/// The delimiter ranges of the pair surrounding the cursor: a literal search
/// for an explicit pair character, or the tree-sitter based closest pair for
/// 'm', matching `mim`/`mam`.... |
rust_dataset_chunk_506433 | rust_dataset.txt | 506,433 | 512 | around the pre-edit offset: everything inserted there ends up
/// between them.
before: Anchor,
after: Anchor,
/// The length of the text requested at this offset that belongs before
/// the edge.
skip: usize,
}
impl SurroundedEdge {
fn new(snapshot: &MultiBufferSnapshot, offset: MultiBuff... |
rust_dataset_chunk_506434 | rust_dataset.txt | 506,434 | 512 | (|edge| edge.start.resolve(&snapshot)..edge.end.resolve(&snapshot)),
),
});
editor.set_clip_at_line_ends(true, cx);
});
});
}
impl Vim {
/// ms - Add surrounding characters around selection.
pub fn helix_surround_add(&mut self, text: &str, window: &mut Window... |
rust_dataset_chunk_506435 | rust_dataset.txt | 506,435 | 512 | ()));
if selection.reversed {
ranges.push(end_edge..start_edge);
} else {
ranges.push(start_edge..end_edge);
}
}
(edits, SurroundSelections::Surrounded(ranges))
});
}
/// mr - Replace inner... |
rust_dataset_chunk_506436 | rust_dataset.txt | 506,436 | 512 | editor::actions::ExpandAllDiffHunks;
use editor::test::editor_test_context::EditorTestContext;
use editor::{Editor, EditorMode, MultiBuffer, MultiBufferOffset};
use gpui::{Entity, UpdateGlobal};
use indoc::indoc;
use language::{Buffer, Point};
use settings::SettingsStore;
use std::ops::Rang... |
rust_dataset_chunk_506437 | rust_dataset.txt | 506,437 | 512 | m s \"");
cx.assert_state("«\"a\"ˇ»«\"b\"ˇ»«\"c\"ˇ»«\"d\"ˇ»", Mode::HelixNormal);
cx.set_state("«ifˇ» «ifˇ»«ifˇ»", Mode::HelixNormal);
cx.simulate_keystrokes("m s (");
cx.assert_state("«(if)ˇ» «(if)ˇ»«(if)ˇ»", Mode::HelixNormal);
cx.set_state("«ˇno»«ˇob»", Mode::HelixNormal);... |
rust_dataset_chunk_506438 | rust_dataset.txt | 506,438 | 512 | cx);
},
)
.await;
cx.set_selections_state("«Aaˇ»");
cx.simulate_keystrokes("m s (");
cx.assert_editor_state("«(Aaˇ»");
assert_eq!(source.read_with(&cx.cx, |buffer, _| buffer.text()), "(Aa)b");
}
#[gpui::test]
async fn test_helix_surround_add_bet... |
rust_dataset_chunk_506439 | rust_dataset.txt | 506,439 | 512 | ystrokes("m s (");
cx.assert_state("a«(\n)ˇ»«(b)ˇ»\n", Mode::HelixNormal);
}
#[gpui::test]
async fn test_helix_surround_add_composes(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
// The new selection includes the added... |
rust_dataset_chunk_506440 | rust_dataset.txt | 506,440 | 512 | .simulate_keystrokes("m d \"");
cx.assert_state("hello woˇrld test", Mode::HelixNormal);
cx.set_state("hello woˇrld test", Mode::HelixNormal);
cx.simulate_keystrokes("m d (");
cx.assert_state("hello woˇrld test", Mode::HelixNormal);
cx.set_state(
indoc! {"
... |
rust_dataset_chunk_506441 | rust_dataset.txt | 506,441 | 512 | world() {
}"},
Mode::HelixNormal,
);
cx.simulate_keystrokes("m r ( [");
cx.assert_state(
indoc! {"
\"heˇllo\"
fn world() {
}"},
Mode::HelixNormal,
);
cx.set_state("((woˇrld))", Mode::HelixNormal... |
rust_dataset_chunk_506442 | rust_dataset.txt | 506,442 | 512 | rokes("m d (");
cx.assert_state(
indoc! {"
heˇllo
woˇrld"},
Mode::HelixNormal,
);
}
#[gpui::test]
async fn test_helix_surround_escape_cancels(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx... |
rust_dataset_chunk_506443 | rust_dataset.txt | 506,443 | 512 | 'a' looks for literal 'a...a', not <>
cx.set_state("hello <woˇrld> test", Mode::HelixNormal);
cx.simulate_keystrokes("m d a");
cx.assert_state("hello <woˇrld> test", Mode::HelixNormal);
// Arbitrary chars work as symmetric pairs (Helix feature)
cx.set_state("hello *woˇrld* test... |
rust_dataset_chunk_506444 | rust_dataset.txt | 506,444 | 512 | ::HelixNormal);
cx.simulate_keystrokes("m d m");
cx.assert_state("(woˇrld)", Mode::HelixNormal);
// 'm' matches via the language's bracket queries, so brackets inside
// a string literal are plain text and the quotes are the closest pair.
cx.set_state("let s = (\"a (bˇc) d\");",... |
rust_dataset_chunk_506445 | rust_dataset.txt | 506,445 | 512 | });
let (editor, cx) = cx.add_window_view(|window, cx| {
Editor::new(EditorMode::full(), multi_buffer, None, window, cx)
});
(EditorTestContext::for_editor_in(editor, cx).await, source)
}
}
--- FILE: zed/crates/vim/src/indent.rs ---
use crate::{Vim, motion::Motion, obje... |
rust_dataset_chunk_506446 | rust_dataset.txt | 506,446 | 512 | act(window, cx, |editor, window, cx| {
let original_positions = vim.save_selection_starts(editor, cx);
for _ in 0..count {
editor.outdent(&Default::default(), window, cx);
}
if !HelixModeSetting::get_global(cx).0 {
v... |
rust_dataset_chunk_506447 | rust_dataset.txt | 506,447 | 512 | Default::default(), window, cx),
IndentDirection::Out => editor.outdent(&Default::default(), window, cx),
IndentDirection::Auto => editor.autoindent(&Default::default(), window, cx),
}
editor.change_selections(SelectionEffects::no_scroll(), window,... |
rust_dataset_chunk_506448 | rust_dataset.txt | 506,448 | 512 | new(cx).await;
cx.set_neovim_option("shiftwidth=4").await;
cx.set_shared_state("ˇhello\nworld\n").await;
cx.simulate_shared_keystrokes("v j > g v").await;
cx.shared_state()
.await
.assert_eq("« hello\n ˇ» world\n");
}
#[gpui::test]
async fn test... |
rust_dataset_chunk_506449 | rust_dataset.txt | 506,449 | 512 | the next character from the line below into the current line.
InsertFromBelow
]
);
pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, Vim::normal_before);
Vim::action(editor, cx, Vim::temporary_normal);
Vim::action(editor, cx, |vim, _: &InsertFromAbove, windo... |
rust_dataset_chunk_506450 | rust_dataset.txt | 506,450 | 512 | }
});
self.switch_mode(Mode::HelixNormal, false, window, cx);
return;
}
self.update_editor(cx, |_, editor, cx| {
editor.dismiss_menus_and_popups(false, window, cx);
editor.change_selections(Defa... |
rust_dataset_chunk_506451 | rust_dataset.txt | 506,451 | 512 | cx.simulate_keystrokes("T e s t");
cx.assert_editor_state("Testˇ");
cx.simulate_keystrokes("escape");
assert_eq!(cx.mode(), Mode::Normal);
cx.assert_editor_state("Tesˇt");
}
#[gpui::test]
async fn test_insert_with_counts(cx: &mut gpui::TestAppContext) {
let mut cx =... |
rust_dataset_chunk_506452 | rust_dataset.txt | 506,452 | 512 | cx.set_shared_state("ˇhello\n").await;
cx.simulate_shared_keystrokes("2 o k k escape").await;
cx.shared_state().await.assert_eq("hello\nkk\nkˇk\n");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state()
.await
.assert_eq("hello\nkk\nkk\nkk\nkˇk\n");
... |
rust_dataset_chunk_506453 | rust_dataset.txt | 506,453 | 512 | new(window: &mut Window, cx: &mut Context<Self>) -> Self {
cx.observe_pending_input(window, |this: &mut Self, window, cx| {
this.update_pending_keys(window, cx);
cx.notify();
})
.detach();
let handle = cx.entity();
let window_handle = window.window_handl... |
rust_dataset_chunk_506454 | rust_dataset.txt | 506,454 | 512 | _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let vim = self.vim();
let Some(vim) = vim else {
return div().hidden().into_any_element();
};
let vim_readable = vim.read(cx);
let status_label = vim_readable.status_label.clone();
let temp_mode =... |
rust_dataset_chunk_506455 | rust_dataset.txt | 506,455 | 512 | self
.pending_keys
.as_ref()
.unwrap_or(¤t_operators_description);
let mode = if bg_color != system_transparent {
mode_str.into()
} else {
format!("-- {} --", mode_str).into()
};
(pendi... |
rust_dataset_chunk_506456 | rust_dataset.txt | 506,456 | 512 | _buffer::MultiBufferRow;
use schemars::JsonSchema;
use serde::Deserialize;
use std::ops::Range;
use workspace::searchable::Direction;
use crate::{
Vim,
normal::mark,
state::{Mode, Operator},
surrounds::SurroundsType,
};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum MotionKind {
Lin... |
rust_dataset_chunk_506457 | rust_dataset.txt | 506,457 | 512 | ,
},
Sneak {
first_char: char,
second_char: char,
smartcase: bool,
},
SneakBackward {
first_char: char,
second_char: char,
smartcase: bool,
},
RepeatFind {
last_find: Box<Motion>,
},
RepeatFindReversed {
last_find: Box<Motio... |
rust_dataset_chunk_506458 | rust_dataset.txt | 506,458 | 512 | WordEnd {
#[serde(default)]
ignore_punctuation: bool,
}
/// Moves to the start of the next subword.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
pub(crate) struct NextSubwordStart {
#[serde(default)]
pub(crate) ignore_punctuation:... |
rust_dataset_chunk_506459 | rust_dataset.txt | 506,459 | 512 | parentheses are
/// matched, which aligns with Neovim's default `%` behavior.
match_quotes: bool,
}
/// Moves to the end of the current line.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
struct EndOfLine {
#[serde(default)]
displ... |
rust_dataset_chunk_506460 | rust_dataset.txt | 506,460 | 512 | next line.
NextLineStart,
/// Moves to the start of the previous line.
PreviousLineStart,
/// Moves to the start of a line downward.
StartOfLineDownward,
/// Moves to the end of a line downward.
EndOfLineDownward,
/// Goes to a specific column number.
... |
rust_dataset_chunk_506461 | rust_dataset.txt | 506,461 | 512 | vim.motion(
Motion::Down {
display_lines: action.display_lines,
},
window,
cx,
)
});
Vim::action(editor, cx, |vim, action: &Up, window, cx| {
vim.motion(
Motion::Up {
display_lines: action.display... |
rust_dataset_chunk_506462 | rust_dataset.txt | 506,462 | 512 | SentenceForward, window, cx)
});
Vim::action(editor, cx, |vim, _: &SentenceBackward, window, cx| {
vim.motion(Motion::SentenceBackward, window, cx)
});
Vim::action(editor, cx, |vim, _: &StartOfDocument, window, cx| {
vim.motion(Motion::StartOfDocument, window, cx)
});
Vim::action... |
rust_dataset_chunk_506463 | rust_dataset.txt | 506,463 | 512 | {
vim.motion(Motion::PreviousWordEnd { ignore_punctuation }, window, cx)
},
);
Vim::action(
editor,
cx,
|vim, &NextSubwordStart { ignore_punctuation }: &NextSubwordStart, window, cx| {
vim.motion(Motion::NextSubwordStart { ignore_punctuation }, window, cx... |
rust_dataset_chunk_506464 | rust_dataset.txt | 506,464 | 512 | window, cx);
}
});
Vim::action(editor, cx, |vim, _: &RepeatFindReversed, window, cx| {
if let Some(last_find) = Vim::globals(cx).last_find.clone().map(Box::new) {
vim.motion(Motion::RepeatFindReversed { last_find }, window, cx);
}
});
Vim::action(editor, cx, |vim, &... |
rust_dataset_chunk_506465 | rust_dataset.txt | 506,465 | 512 | Vim::action(editor, cx, |vim, &PreviousComment, window, cx| {
vim.motion(Motion::PreviousComment, window, cx)
});
Vim::action(editor, cx, |vim, &PreviousLesserIndent, window, cx| {
vim.motion(Motion::PreviousLesserIndent, window, cx)
});
Vim::action(editor, cx, |vim, &PreviousGreater... |
rust_dataset_chunk_506466 | rust_dataset.txt | 506,466 | 512 | | Some(Operator::SneakBackward { .. })
| Some(Operator::FindBackward { .. }) = self.active_operator()
{
self.pop_operator(window, cx);
}
let count = Vim::take_count(cx);
let forced_motion = Vim::take_forced_motion(cx);
let active_operator = self.activ... |
rust_dataset_chunk_506467 | rust_dataset.txt | 506,467 | 512 | | Jump { line: true, .. } => MotionKind::Linewise,
EndOfLine { .. }
| EndOfLineDownward
| Matching { .. }
| FindForward { .. }
| NextWordEnd { .. }
| PreviousWordEnd { .. }
| NextSubwordEnd { .. }
| PreviousSubwo... |
rust_dataset_chunk_506468 | rust_dataset.txt | 506,468 | 512 | OfLine { .. }
| StartOfLineDownward
| Up { .. }
| WrappingLeft
| WrappingRight => false,
EndOfDocument
| EndOfParagraph
| GoToPercentage
| Jump { .. }
| Matching { .. }
| NextComment
| Nex... |
rust_dataset_chunk_506469 | rust_dataset.txt | 506,469 | 512 | | SneakBackward { .. }
| RepeatFindReversed { .. }
| WindowTop
| WindowMiddle
| WindowBottom
| NextLineStart
| PreviousLineStart
| ZedSearchResult { .. }
| NextSectionStart
| NextSectionEnd
... |
rust_dataset_chunk_506470 | rust_dataset.txt | 506,470 | 512 | Goal::None,
),
PreviousWordStart { ignore_punctuation } => (
previous_word_start(map, point, *ignore_punctuation, times),
SelectionGoal::None,
),
PreviousWordEnd { ignore_punctuation } => (
previous_word_end(map, point, *ign... |
rust_dataset_chunk_506471 | rust_dataset.txt | 506,471 | 512 | _quotes } => (matching(map, point, *match_quotes), SelectionGoal::None),
GoToPercentage => (go_to_percentage(map, point, times), SelectionGoal::None),
UnmatchedForward { char } => (
unmatched_forward(map, point, *char, times),
SelectionGoal::None,
),
... |
rust_dataset_chunk_506472 | rust_dataset.txt | 506,472 | 512 | , after, char, times, mode, smartcase);
if new_point == point {
new_point =
find_backward(map, point, after, char, times + 1, mode, smartcase);
}
(new_point, SelectionGoal::None)
}
... |
rust_dataset_chunk_506473 | rust_dataset.txt | 506,473 | 512 | Goal::None));
}
Motion::Sneak {
first_char,
second_char,
smartcase,
} => {
let mut new_point =
sneak_backward(map, point, first_char, second_char, times, smartcase);
... |
rust_dataset_chunk_506474 | rust_dataset.txt | 506,474 | 512 | Goal::None,
),
NextSectionEnd => (
section_motion(map, point, times, Direction::Next, false),
SelectionGoal::None,
),
PreviousSectionStart => (
section_motion(map, point, times, Direction::Prev, true),
Select... |
rust_dataset_chunk_506475 | rust_dataset.txt | 506,475 | 512 | : &DisplaySnapshot,
mut selection: Selection<DisplayPoint>,
times: Option<usize>,
text_layout_details: &TextLayoutDetails,
forced_motion: bool,
) -> Option<(Range<DisplayPoint>, MotionKind)> {
if let Motion::ZedSearchResult {
prior_selections,
new_sele... |
rust_dataset_chunk_506476 | rust_dataset.txt | 506,476 | 512 | end.row > start.row {
selection.end = Point::new(start_row.0, map.buffer_snapshot().line_len(start_row))
.to_display_point(map);
// a bit of a hack, we need `cw` on a blank line to not delete the newline,
// but dw on a blank line should. The `Linewi... |
rust_dataset_chunk_506477 | rust_dataset.txt | 506,477 | 512 | ::Linewise;
} else {
kind = MotionKind::Inclusive;
}
end_point.row -= 1;
end_point.column = 0;
selection.end = map.clip_point(map.next_line_boundary(end_point).1, Bias::Left);
} el... |
rust_dataset_chunk_506478 | rust_dataset.txt | 506,478 | 512 | point);
if point.is_zero() {
break;
}
}
point
}
fn wrapping_right(map: &DisplaySnapshot, mut point: DisplayPoint, times: usize) -> DisplayPoint {
for _ in 0..times {
point = wrapping_right_single(map, point);
if point == map.max_point() {
break;
... |
rust_dataset_chunk_506479 | rust_dataset.txt | 506,479 | 512 | => {
let x = map.x_for_display_point(point, text_layout_details);
goal = SelectionGoal::WrappedHorizontalPosition((select_nth_wrapped_row, x.into()));
(select_nth_wrapped_row, x.into())
}
};
let target = start.row() as isize + times;
let new_row = (target.max(0)... |
rust_dataset_chunk_506480 | rust_dataset.txt | 506,480 | 512 | , text_layout_details);
}
(point, goal)
}
fn up_display(
map: &DisplaySnapshot,
mut point: DisplayPoint,
mut goal: SelectionGoal,
times: usize,
text_layout_details: &TextLayoutDetails,
) -> (DisplayPoint, SelectionGoal) {
for _ in 0..times {
(point, goal) = movement::up(map, po... |
rust_dataset_chunk_506481 | rust_dataset.txt | 506,481 | 512 | s skipping repeated empty lines
crossed_newline |= at_newline;
found
});
if point == new_point {
break;
}
point = new_point;
}
point
}
fn next_end_impl(
map: &DisplaySnapshot,
mut point: DisplayPoint,
times: usize,
... |
rust_dataset_chunk_506482 | rust_dataset.txt | 506,482 | 512 | ()
.char_classifier_at(point.to_point(map))
.ignore_punctuation(ignore_punctuation);
next_end_impl(
map,
point,
times,
allow_cross_newline,
true,
&mut |left, right| {
let left_kind = classifier.kind(left);
let right_kind = clas... |
rust_dataset_chunk_506483 | rust_dataset.txt | 506,483 | 512 | _point = movement::find_preceding_boundary_point(
&map.buffer_snapshot(),
point,
FindRange::MultiLine,
&mut |left, right| {
let left_kind = classifier.kind(left);
let right_kind = classifier.kind(right);
match (left_kind, ri... |
rust_dataset_chunk_506484 | rust_dataset.txt | 506,484 | 512 | MultiLine, &mut |left, right| {
let left_kind = classifier.kind(left);
let right_kind = classifier.kind(right);
let at_newline = right == '\n';
let is_stopping_punct = |c: char| "$=\"'{}[]()<>".contains(c);
let found_subword_start = is_subw... |
rust_dataset_chunk_506485 | rust_dataset.txt | 506,485 | 512 | _newline;
found
},
);
if point == new_point {
break;
}
point = new_point;
}
point
}
fn previous_subword_end(
map: &DisplaySnapshot,
point: DisplayPoint,
ignore_punctuation: bool,
times: usize,
) -> DisplayPoint {
let c... |
rust_dataset_chunk_506486 | rust_dataset.txt | 506,486 | 512 | from;
}
start_offset = offset;
if classifier.kind(ch) != CharKind::Whitespace {
break;
}
}
start_offset.to_display_point(map)
}
pub(crate) fn last_non_whitespace(
map: &DisplaySnapshot,
from: DisplayPoint,
count: usize,
) -> DisplayPoint {
let mut... |
rust_dataset_chunk_506487 | rust_dataset.txt | 506,487 | 512 | _display_point(map), Bias::Left)
}
}
pub(crate) fn end_of_line(
map: &DisplaySnapshot,
display_lines: bool,
mut point: DisplayPoint,
times: usize,
) -> DisplayPoint {
if times > 1 {
point = map.start_of_relative_buffer_row(point, times as isize - 1);
}
if display_lines {
... |
rust_dataset_chunk_506488 | rust_dataset.txt | 506,488 | 512 | let start = point.to_point(map).to_offset(&map.buffer_snapshot());
let mut chars = map.buffer_chars_at(start).peekable();
let mut was_newline = map
.reverse_buffer_chars_at(start)
.next()
.is_some_and(|(c, _)| c == '\n')
&& chars.peek().is_some_and(|(c, _)| *c == '\n');
wh... |
rust_dataset_chunk_506489 | rust_dataset.txt | 506,489 | 512 | _display_point(map);
}
count -= 1;
found_non_empty_line = false;
}
found_non_empty_line |= !empty;
}
DisplayPoint::zero()
}
/// Returns a position of the end of the current paragraph for vim motions,
/// where a paragraph is defined as a run of non-empty li... |
rust_dataset_chunk_506490 | rust_dataset.txt | 506,490 | 512 | Some(map.buffer_snapshot().len())
}
fn go_to_line(map: &DisplaySnapshot, display_point: DisplayPoint, line: usize) -> DisplayPoint {
let point = map.display_point_to_point(display_point, Bias::Left);
let snapshot = map.buffer_snapshot();
let Some((buffer_snapshot, _)) = snapshot.point_to_buffer_point(poin... |
rust_dataset_chunk_506491 | rust_dataset.txt | 506,491 | 512 | (map, Bias::Left);
for c in map.buffer_snapshot().chars_at(offset) {
if c == '/' || c == '\n' || c == '>' {
return Some(offset.to_display_point(map));
}
offset += c.len_utf8();
}
} else {
let mut offset = outer.start.to_offset(map, Bias::Le... |
rust_dataset_chunk_506492 | rust_dataset.txt | 506,492 | 512 | depth -= 1;
if depth == 0 {
return Some(char_offset);
}
}
}
}
None
}
fn find_matching_c_preprocessor_directive(
map: &DisplaySnapshot,
line_range: Range<MultiBufferOffset>,
offset: MultiBufferOffset,
) -> Option<MultiBufferOf... |
rust_dataset_chunk_506493 | rust_dataset.txt | 506,493 | 512 | (0) {
MultiBufferOffset(0)
} else if ch != '\n' {
continue;
} else {
char_offset + '\n'.len_utf8()
};
// Skip leading whitespace
map.buffer_chars_at(line_offset)
.take_while(|(c, _)| *c == ' ' ||... |
rust_dataset_chunk_506494 | rust_dataset.txt | 506,494 | 512 | map.clip_at_line_end(display_point);
let point = display_point.to_point(map);
let offset = point.to_offset(&map.buffer_snapshot());
let snapshot = map.buffer_snapshot();
// Ensure the range is contained by the current line.
let mut line_end = map.next_line_boundary(point).0;
let max_point = ma... |
rust_dataset_chunk_506495 | rust_dataset.txt | 506,495 | 512 | _ranges(offset..offset, Some(&make_range_filter(true)))
.or_else(|| {
snapshot
.innermost_enclosing_bracket_ranges(offset..offset, Some(&make_range_filter(false)))
});
if let Some((opening_range, closing_range)) = bracket_ranges {
let mut chars = map.buffer_snaps... |
rust_dataset_chunk_506496 | rust_dataset.txt | 506,496 | 512 | = distance;
}
}
if (close_range.contains(&offset) || close_range.start >= offset)
&& line_range.contains(&close_range.start)
{
let distance = close_range.start.saturating_sub(offset);
if distance < closest_distance {
... |
rust_dataset_chunk_506497 | rust_dataset.txt | 506,497 | 512 | ::MAX;
for (_, close_range) in ranges {
if close_range.start > offset {
let mut chars = map.buffer_snapshot().chars_at(close_range.start);
if Some(char) == chars.next() {
let distance = close_range.start - offset;
if distance <... |
rust_dataset_chunk_506498 | rust_dataset.txt | 506,498 | 512 | = from;
let mut found = false;
for _ in 0..times {
found = false;
let new_to = find_boundary(map, to, mode, &mut |_, right| {
found = is_character_match(target, right, smartcase);
found
});
if to == new_to {
break;
}
to = new_... |
rust_dataset_chunk_506499 | rust_dataset.txt | 506,499 | 512 | ,
smartcase: bool,
) -> Option<DisplayPoint> {
let mut to = from;
let mut found = false;
for _ in 0..times {
found = false;
let new_to = find_boundary(
map,
movement::right(map, to),
FindRange::MultiLine,
&mut |left, right| {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.