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_506600 | rust_dataset.txt | 506,600 | 512 | ("up shift-v shift-p").await;
cx.shared_state().await.assert_eq(indoc! {"
ˇover
fox jumps jumps
the lazy dog"});
cx.shared_clipboard().await.assert_eq("over");
// paste in visual block mode
cx.simulate_shared_keystrokes("ctrl-v down down p").await;
... |
rust_dataset_chunk_506601 | rust_dataset.txt | 506,601 | 512 | async fn test_paste_visual_block(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// copy in visual block mode
cx.set_shared_state(indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"})
.await;
cx... |
rust_dataset_chunk_506602 | rust_dataset.txt | 506,602 | 512 | ,
);
// cursor goes to the first non-blank character in the line;
cx.simulate_keystrokes("y y p");
cx.assert_state(
indoc! {"
class A {
a(){}
ˇa(){}
}
"},
Mode::Normal,
);
// inden... |
rust_dataset_chunk_506603 | rust_dataset.txt | 506,603 | 512 | ::new(cx).await;
cx.set_shared_state(indoc! {"
onˇe
two
three
"})
.await;
cx.simulate_shared_keystrokes("y y 3 p").await;
cx.shared_state().await.assert_eq(indoc! {"
one
ˇone
one
one
... |
rust_dataset_chunk_506604 | rust_dataset.txt | 506,604 | 512 | cx.set_state(
indoc! {"
The quick brown
fox ˇjumps over
the lazy dog"},
Mode::Normal,
);
// Put known content on the system clipboard
cx.write_to_clipboard(ClipboardItem::new_string("from clipboard".to_string()));
... |
rust_dataset_chunk_506605 | rust_dataset.txt | 506,605 | 512 | .assert_eq("fox jumps over\n");
cx.shared_register('3').await.assert_eq("The quick brown\n");
cx.shared_register('2').await.assert_eq("fox jumps over\n");
cx.shared_register('1').await.assert_eq("the lazy dog\n");
cx.shared_state().await.assert_eq(indoc! {"
ˇfox jumps over"});
... |
rust_dataset_chunk_506606 | rust_dataset.txt | 506,606 | 512 | .set_shared_state(indoc! {"
The quick brown
fox jˇumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("d i w").await;
cx.shared_register('-').await.assert_eq("jumps");
cx.simulate_shared_keystrokes("\" _ d d").await;
... |
rust_dataset_chunk_506607 | rust_dataset.txt | 506,607 | 512 | �fish one
fish two
fish red
fish blue
"},
Mode::Normal,
);
cx.simulate_keystrokes("4 g l w escape d i w 0 shift-p");
cx.assert_state(
indoc! {"
onˇefish•
twˇofish•
re... |
rust_dataset_chunk_506608 | rust_dataset.txt | 506,608 | 512 | : Register = cx.read_from_clipboard().unwrap().into();
assert_eq!(clipboard.text, "fish");
}
#[gpui::test]
async fn test_replace_with_register_dot_repeat(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {"
... |
rust_dataset_chunk_506609 | rust_dataset.txt | 506,609 | 512 | two
line three"},
Mode::Normal,
);
}
#[gpui::test]
async fn test_paste_multiple_clipboard_selections_at_end_of_file(
cx: &mut gpui::TestAppContext,
) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state("012345678901234567890ˇ", M... |
rust_dataset_chunk_506610 | rust_dataset.txt | 506,610 | 512 | ˇfirst line
second line
third line"},
Mode::Normal,
);
cx.simulate_keystrokes("y y j p");
cx.assert_state(
indoc! {"
first line
second line
ˇfirst line
third li... |
rust_dataset_chunk_506611 | rust_dataset.txt | 506,611 | 512 | ", Mode::Normal);
}
#[gpui::test]
async fn test_paste_marks_linewise_before(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {"
ˇfirst line
second line
third line"},
... |
rust_dataset_chunk_506612 | rust_dataset.txt | 506,612 | 512 | } else {
None
}
}
ReplayableAction::Insertion { .. } => None,
}
}
pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, _: &EndRepeat, window, cx| {
Vim::globals(cx).dot_replaying = false;
vim.s... |
rust_dataset_chunk_506613 | rust_dataset.txt | 506,613 | 512 | >(cx))
else {
return;
};
editor.update(cx, |editor, cx| {
editor
.buffer()
.update(cx, |multi, cx| multi.finalize_last_transaction(cx))
});
})
}
pub fn stop(self) {
self.0.bor... |
rust_dataset_chunk_506614 | rust_dataset.txt | 506,614 | 512 | .remove(®ister);
globals.ignore_current_insertion = true;
self.clear_operator(window, cx)
}
pub(crate) fn replay_register(
&mut self,
mut register: char,
window: &mut Window,
cx: &mut Context<Self>,
) {
let mut count = Vim::take_count(cx).unwrap_or... |
rust_dataset_chunk_506615 | rust_dataset.txt | 506,615 | 512 | ed_count = None;
mode = Some(Mode::Visual);
}
RecordedSelection::VisualLine { .. } => {
globals.recorded_count = None;
mode = Some(Mode::VisualLine)
}
RecordedSelection::VisualBlock { .. } => {
... |
rust_dataset_chunk_506616 | rust_dataset.txt | 506,616 | 512 | ::VisualBlock { rows, cols } => {
self.visual_motion(
Motion::Down {
display_lines: false,
},
Some(rows as usize),
window,
cx,
);
... |
rust_dataset_chunk_506617 | rust_dataset.txt | 506,617 | 512 | InputHandler;
use crate::{
VimGlobals,
state::Mode,
test::{NeovimBackedTestContext, VimTestContext},
};
#[gpui::test]
async fn test_dot_repeat(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// "o"
cx.set_shared_sta... |
rust_dataset_chunk_506618 | rust_dataset.txt | 506,618 | 512 | hello world\n");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state()
.await
.assert_eq("hello worlˇd\nhello world\nhello world\n");
}
#[gpui::test]
async fn test_dot_repeat_after_macro_change_motion(cx: &mut gpui::TestAppContext) {
let mut cx = VimTes... |
rust_dataset_chunk_506619 | rust_dataset.txt | 506,619 | 512 | two
two
ˇtwo
"});
// `"X.` ignores the override and always uses the recorded register.
// Both `dd` calls go into register `a`, so register `b` is empty and
// `"bp` pastes nothing.
cx.set_shared_state(indoc! {"
ˇone
tw... |
rust_dataset_chunk_506620 | rust_dataset.txt | 506,620 | 512 | // so the next `.` uses `a` and not 3.
cx.set_shared_state(indoc! {"
one
two
ˇthree
"})
.await;
cx.simulate_shared_keystrokes("\" 2 y y k k \" a y y j \" 1 y y k \" 1 p . \" a p .")
.await;
cx.shared_state().await.assert... |
rust_dataset_chunk_506621 | rust_dataset.txt | 506,621 | 512 | into register `2`
// 3. Move down and yank `three` into the default register
// 4. Replace `three` with the contents of register `1`
// 5. Move down and repeat
cx.simulate_keystrokes("\" 1 y w j \" 2 y w j y w \" 1 g R w j .");
cx.assert_state(
indoc! {"
... |
rust_dataset_chunk_506622 | rust_dataset.txt | 506,622 | 512 | ::Array(vec![
lsp::CompletionItem {
label: "first".to_string(),
text_edit: Some(lsp::CompletionTextEdit::Edit(lsp::TextEdit {
range: lsp::Range::new(position, position),
new_text: "first".to_strin... |
rust_dataset_chunk_506623 | rust_dataset.txt | 506,623 | 512 | "oops".to_string(),
text_edit: Some(lsp::CompletionTextEdit::Edit(lsp::TextEdit {
range: lsp::Range::new(to_the_left, position),
new_text: "к!".to_string(),
})),
..Default::default()
... |
rust_dataset_chunk_506624 | rust_dataset.txt | 506,624 | 512 | over
the lazy dog"
});
cx.simulate_shared_keystrokes("w .").await;
cx.shared_state().await.assert_eq(indoc! {
"the umps ˇumps over
the lazy dog"
});
cx.simulate_shared_keystrokes("j .").await;
cx.shared_state().await.assert_eq(indoc! {... |
rust_dataset_chunk_506625 | rust_dataset.txt | 506,625 | 512 | ystrokes("j .").await;
cx.shared_state().await.assert_eq(indoc! {
" brown
ˇ over
the lazy dog"
});
cx.simulate_shared_keystrokes("j 2 .").await;
cx.shared_state().await.assert_eq(indoc! {
" brown
over
ˇe lazy dog"
... |
rust_dataset_chunk_506626 | rust_dataset.txt | 506,626 | 512 | the buffer search will move focus away from the
// editor, effectively stopping the recording immediately after
// `buffer_search::Deploy` is recorded. The first `escape` is used to
// dismiss the search bar, while the second is used to move from Insert
// to Normal mode.
cx.sim... |
rust_dataset_chunk_506627 | rust_dataset.txt | 506,627 | 512 | imBackedTestContext::new(cx).await;
cx.set_shared_state("ˇhello world!!").await;
cx.simulate_shared_keystrokes("q a v 3 l s 0 escape l q")
.await;
cx.shared_state().await.assert_eq("0ˇo world!!");
cx.simulate_shared_keystrokes("2 @ a").await;
cx.shared_state().await.... |
rust_dataset_chunk_506628 | rust_dataset.txt | 506,628 | 512 | .assert_eq("aˇello world");
cx.simulate_shared_keystrokes("q b @ z @ z q").await;
cx.shared_state().await.assert_eq("aaaˇlo world");
cx.simulate_shared_keystrokes("@ @").await;
cx.shared_state().await.assert_eq("aaaaˇo world");
cx.simulate_shared_keystrokes("@ b").await;
... |
rust_dataset_chunk_506629 | rust_dataset.txt | 506,629 | 512 | {
"ˇthe quick brown
fox jumps over
the lazy dog"
})
.await;
cx.simulate_shared_keystrokes("d d").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇfox jumps over
the lazy dog"
});
cx.simulate_shared_keystrokes... |
rust_dataset_chunk_506630 | rust_dataset.txt | 506,630 | 512 | Point, movement};
use gpui::{Context, TaskExt, Window, actions};
use language::{AutoIndentMode, Point, SelectionGoal};
use log::error;
use multi_buffer::MultiBufferRow;
actions!(
vim,
[
/// Inserts text after the cursor.
InsertAfter,
/// Inserts text before the cursor.
InsertBef... |
rust_dataset_chunk_506631 | rust_dataset.txt | 506,631 | 512 | count support).
GoToTab,
/// Go to previous tab page (with count support).
GoToPreviousTab,
/// Goes to the previous reference to the symbol under the cursor.
GoToPreviousReference,
/// Goes to the next reference to the symbol under the cursor.
GoToNextReference,... |
rust_dataset_chunk_506632 | rust_dataset.txt | 506,632 | 512 | );
});
Vim::action(editor, cx, |vim, _: &HelixDelete, window, cx| {
vim.record_current_action(cx);
let original_selections =
vim.update_editor(cx, |_, editor, _| editor.selections.disjoint_anchors_arc());
vim.update_editor(cx, |_, editor, cx| {
editor.change_sele... |
rust_dataset_chunk_506633 | rust_dataset.txt | 506,633 | 512 | );
vim.delete_motion(
Motion::EndOfLine {
display_lines: false,
},
times,
forced_motion,
window,
cx,
);
});
Vim::action(editor, cx, |vim, _: &JoinLines, window, cx| {
vim.join_lines_impl(true, window,... |
rust_dataset_chunk_506634 | rust_dataset.txt | 506,634 | 512 | {
Vim::take_forced_motion(cx);
vim.update_editor(cx, |vim, editor, cx| {
let snapshot = editor.buffer().read(cx).snapshot(cx);
let Some(last_change) = editor.change_list.last_before_grouping() else {
return;
};
let anchors = last_change.t... |
rust_dataset_chunk_506635 | rust_dataset.txt | 506,635 | 512 | .char_indices()
.rev()
.zip(new_text.chars().rev())
.find_map(
|((i, a), b)| {
if a != b { Some(i + a.len_utf8()) } else { None }
},
... |
rust_dataset_chunk_506636 | rust_dataset.txt | 506,636 | 512 | ::Indent) => self.indent_motion(
motion,
times,
forced_motion,
IndentDirection::In,
window,
cx,
),
Some(Operator::Rewrap) => self.rewrap_motion(motion, times, forced_motion, window, cx),
S... |
rust_dataset_chunk_506637 | rust_dataset.txt | 506,637 | 512 | normal mode (if active).
self.exit_temporary_normal(window, cx);
}
pub fn normal_object(
&mut self,
object: Object,
times: Option<usize>,
opening: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
let mut waiting_operator: Option<Operato... |
rust_dataset_chunk_506638 | rust_dataset.txt | 506,638 | 512 | urroundsType::Object(object, around)),
});
}
Some(Operator::ToggleComments) => {
self.toggle_comments_object(object, around, times, window, cx)
}
Some(Operator::ToggleBlockComments) => {
self.togg... |
rust_dataset_chunk_506639 | rust_dataset.txt | 506,639 | 512 |
// back to visual mode, the cursor will be placed after the last
// character and not before it.
let clip_at_line_ends = editor.clip_at_line_ends(cx);
let should_disable_clip = matches!(motion, Motion::EndOfLine { .. }) && vim.temp_mode;
if should_disable_cl... |
rust_dataset_chunk_506640 | rust_dataset.txt | 506,640 | 512 | ,
cx: &mut Context<Self>,
) {
self.start_recording(cx);
self.switch_mode(Mode::Insert, false, window, cx);
self.update_editor(cx, |_, editor, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
s.move_cursors_with(&mut |map, cursor, _| {
... |
rust_dataset_chunk_506641 | rust_dataset.txt | 506,641 | 512 | > = selections
.into_iter()
.map(|selection| selection.start.row)
.collect();
let mut auto_indent_edits = Vec::new();
let mut plain_edits = Vec::new();
for row in selection_start_rows {
let ... |
rust_dataset_chunk_506642 | rust_dataset.txt | 506,642 | 512 | collect();
let mut auto_indent_edits = Vec::new();
let mut plain_edits = Vec::new();
for row in selection_end_rows {
let auto_indent_mode = snapshot
.language_settings_at(Point::new(row, 0), cx)
.auto_i... |
rust_dataset_chunk_506643 | rust_dataset.txt | 506,643 | 512 | > = selections
.into_iter()
.map(|selection| selection.start.row)
.collect();
let edits = selection_start_rows
.into_iter()
.map(|row| {
let start_of_line = Point::new(row, 0);
... |
rust_dataset_chunk_506644 | rust_dataset.txt | 506,644 | 512 | unwrap_or(1);
Vim::take_forced_motion(cx);
if self.mode.is_visual() {
times = 1;
} else if times > 1 {
// 2J joins two lines together (same as J or 1J)
times -= 1;
}
self.update_editor(cx, |_, editor, cx| {
editor.transact(window, ... |
rust_dataset_chunk_506645 | rust_dataset.txt | 506,645 | 512 | } else {
file.path().display(file.path_style(cx)).into_owned()
}
} else {
"[No Name]".into()
};
let buffer = buffer.read(cx);
let lines = buffer.max_point().row + 1;
let current_line = point.r... |
rust_dataset_chunk_506646 | rust_dataset.txt | 506,646 | 512 | to_display_point(map);
});
});
}
editor.toggle_block_comments(&Default::default(), window, cx);
vim.restore_selection_cursors(editor, window, cx, original_positions);
});
});
if self.mode.is_visual() ... |
rust_dataset_chunk_506647 | rust_dataset.txt | 506,647 | 512 | saturating_left(map, selection.head());
selection.collapse_to(point, SelectionGoal::None)
});
});
});
});
self.pop_operator(window, cx);
}
pub fn save_selection_starts(
&self,
editor: &Editor,
cx: &m... |
rust_dataset_chunk_506648 | rust_dataset.txt | 506,648 | 512 | await;
cx.simulate_at_each_offset(
"backspace",
indoc! {"
ˇThe qˇuick
ˇbrown"
},
)
.await
.assert_matches();
}
#[gpui::test]
async fn test_j(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestCont... |
rust_dataset_chunk_506649 | rust_dataset.txt | 506,649 | 512 | }
#[gpui::test]
async fn test_jump_to_line_boundaries(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate_at_each_offset(
"$",
indoc! {"
ˇThe qˇuicˇk
ˇbrowˇn"},
)
.await
.asser... |
rust_dataset_chunk_506650 | rust_dataset.txt | 506,650 | 512 | .assert_matches();
}
#[gpui::test]
async fn test_end_of_word(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate_at_each_offset(
"e",
indoc! {"
Thˇe quicˇkˇ-browˇn
fox_jumpˇs oveˇr
t... |
rust_dataset_chunk_506651 | rust_dataset.txt | 506,651 | 512 | ();
cx.simulate(
"2 g g",
indoc! {"
ˇ
brown fox jumps
over the lazydog"},
)
.await
.assert_matches();
}
#[gpui::test]
async fn test_end_of_document(cx: &mut gpui::TestAppContext) {
let mut cx = ... |
rust_dataset_chunk_506652 | rust_dataset.txt | 506,652 | 512 | ! {"
The qˇuick
brown fox"},
)
.await
.assert_matches();
cx.simulate(
"^",
indoc! {"
ˇ
The quick"},
)
.await
.assert_matches();
// Indoc disallows trailing whitespace.
... |
rust_dataset_chunk_506653 | rust_dataset.txt | 506,653 | 512 | async fn test_delete_left(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate_at_each_offset("shift-x", "ˇTˇeˇsˇt")
.await
.assert_matches();
cx.simulate(
"shift-x",
indoc! {"
Test
... |
rust_dataset_chunk_506654 | rust_dataset.txt | 506,654 | 512 | ˇfox
jumps ˇover"},
)
.await
.assert_matches();
cx.simulate(
"shift-o",
indoc! {"
The quick
ˇ
brown fox"},
)
.await
.assert_matches();
// Our indentation is smarter than vims. So we d... |
rust_dataset_chunk_506655 | rust_dataset.txt | 506,655 | 512 | ! {"
The qˇuick
brown ˇfox
jumps ˇover"},
)
.await
.assert_matches();
cx.simulate(
"[ space",
indoc! {"
The quick
ˇ
brown fox"},
)
.await
.assert_matches();
cx... |
rust_dataset_chunk_506656 | rust_dataset.txt | 506,656 | 512 | "c c",
indoc! {"
The quˇick
brown ˇfox
jumps ˇover"},
)
.await
.assert_matches();
cx.simulate(
"c c",
indoc! {"
The quick
ˇ
brown fox"},
)
... |
rust_dataset_chunk_506657 | rust_dataset.txt | 506,657 | 512 | ]
async fn test_capital_f_and_capital_t(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
let test_case = indoc! {"
ˇaaaˇbˇ ˇbˇ ˇbˇbˇ aˇaaˇbaaa
ˇ ˇbˇaaˇa ˇbˇbˇb
ˇ•••
ˇb
"
};
for coun... |
rust_dataset_chunk_506658 | rust_dataset.txt | 506,658 | 512 | Normal,
);
}
#[gpui::test]
async fn test_percent(cx: &mut TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate_at_each_offset("%", "ˇconsole.logˇ(ˇvaˇrˇ)ˇ;")
.await
.assert_matches();
cx.simulate_at_each_offset("%", "ˇcon... |
rust_dataset_chunk_506659 | rust_dataset.txt | 506,659 | 512 | cx.shared_state().await.assert_eq("aa\nbˇb\ncc");
// try to exceed the final line.
cx.simulate_shared_keystrokes("4 $").await;
cx.shared_state().await.assert_eq("aa\nbb\ncˇc");
}
#[gpui::test]
async fn test_subword_motions(cx: &mut gpui::TestAppContext) {
let mut cx... |
rust_dataset_chunk_506660 | rust_dataset.txt | 506,660 | 512 | ˇz_qux"},
);
// CamelCase at EOL
cx.assert_binding_normal("e", indoc! {"fooˇBar\nbaz"}, indoc! {"fooBaˇr\nbaz"});
cx.assert_binding_normal("b", indoc! {"assert_ˇbinding"}, indoc! {"ˇassert_binding"});
cx.assert_binding_normal(
"g e",
indoc! {"assert_bin... |
rust_dataset_chunk_506661 | rust_dataset.txt | 506,661 | 512 | imBackedTestContext::new(cx).await;
cx.set_neovim_option("textwidth=5").await;
cx.update(|_, cx| {
SettingsStore::update_global(cx, |settings, cx| {
settings.update_user_settings(cx, |settings| {
settings
.project
... |
rust_dataset_chunk_506662 | rust_dataset.txt | 506,662 | 512 | o: new line below starts at column 0 regardless of current indentation
cx.set_state(" let xˇ = 1;", Mode::Normal);
cx.simulate_keystrokes("o");
cx.assert_state(" let x = 1;\nˇ", Mode::Insert);
// O: new line above starts at column 0 regardless of current indentation
cx.se... |
rust_dataset_chunk_506663 | rust_dataset.txt | 506,663 | 512 | Insert);
// O on an unindented line: the new line gets no indentation
cx.set_state("fn test() {\n println!(\"\");\nˇ}", Mode::Normal);
cx.simulate_keystrokes("shift-o");
cx.assert_state("fn test() {\n println!(\"\");\nˇ\n}", Mode::Insert);
}
#[gpui::test]
async fn tes... |
rust_dataset_chunk_506664 | rust_dataset.txt | 506,664 | 512 | fn test_visual_mode_insert_before_after(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("heˇllo").await;
cx.simulate_shared_keystrokes("v i w shift-i").await;
cx.shared_state().await.assert_eq("ˇhello");
cx.set_shared_s... |
rust_dataset_chunk_506665 | rust_dataset.txt | 506,665 | 512 | fn a() { }
"})
.await;
// do a jump to reset vim's undo grouping
cx.simulate_shared_keystrokes("shift-g").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("r a").await;
cx.shared_state().await.assert_matches();
cx.simulat... |
rust_dataset_chunk_506666 | rust_dataset.txt | 506,666 | 512 | ("shift-u").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("shift-u").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("shift-u").await;
cx.shared_state().await.assert_matches();
}
#[gpui::test]
async fn t... |
rust_dataset_chunk_506667 | rust_dataset.txt | 506,667 | 512 | _keystrokes("4 g t");
cx.workspace(|workspace, _, cx| {
assert_eq!(workspace.active_pane().read(cx).active_item_index(), 3);
});
cx.simulate_keystrokes("1 g t");
cx.simulate_keystrokes("g t");
cx.workspace(|workspace, _, cx| {
assert_eq!(workspace.active_... |
rust_dataset_chunk_506668 | rust_dataset.txt | 506,668 | 512 | ˇipsum"}).await;
cx.simulate_shared_keystrokes("i").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("ctrl-o $").await;
cx.shared_state().await.assert_eq(indoc! {"lorem ipsumˇ"});
// Test jumping to the next word.
cx.set_shared_state(indoc!... |
rust_dataset_chunk_506669 | rust_dataset.txt | 506,669 | 512 | cx, |vim, _: &LineDown, window, cx| {
vim.scroll(false, window, cx, |c| ScrollAmount::Line(c.unwrap_or(1.)))
});
Vim::action(editor, cx, |vim, _: &LineUp, window, cx| {
vim.scroll(false, window, cx, |c| ScrollAmount::Line(-c.unwrap_or(1.)))
});
Vim::action(editor, cx, |vim, _: &ColumnRi... |
rust_dataset_chunk_506670 | rust_dataset.txt | 506,670 | 512 | ::Page(-0.5)
}
})
});
}
impl Vim {
fn scroll(
&mut self,
preserve_cursor_position: bool,
window: &mut Window,
cx: &mut Context<Self>,
by: fn(c: Option<f32>) -> ScrollAmount,
) {
let amount = by(Vim::take_count(cx).map(|c| c as f32));
... |
rust_dataset_chunk_506671 | rust_dataset.txt | 506,671 | 512 | {
// TODO: Improve the logic and function calls below to be dependent on
// the `amount`. If the amount is vertical, we don't care about
// columns, while if it's horizontal, we don't care about rows,
// so we don't need to calculate both and deal with lo... |
rust_dataset_chunk_506672 | rust_dataset.txt | 506,672 | 512 | // left-most column in the visible area, or the scroll manager's
// old anchor column, in case the cursor position is being
// preserved. This is necessary for motions like `ctrl-d` in
// case there's not enough content to scroll half page down, in
... |
rust_dataset_chunk_506673 | rust_dataset.txt | 506,673 | 512 | , selection| {
if let Some((new_head, goal)) =
move_cursor(map, selection.head(), selection.goal)
{
if selection.is_empty() || !vim.mode.is_visual() {
selection.col... |
rust_dataset_chunk_506674 | rust_dataset.txt | 506,674 | 512 | editor, window, cx| {
assert_eq!(editor.snapshot(window, cx).scroll_position(), point(0., 0.))
});
cx.simulate_keystrokes("ctrl-e");
cx.update_editor(|editor, window, cx| {
assert_eq!(editor.snapshot(window, cx).scroll_position(), point(0., 1.))
});
cx.sim... |
rust_dataset_chunk_506675 | rust_dataset.txt | 506,675 | 512 | edTestContext::new(cx).await;
cx.set_scroll_height(10).await;
let content = "ˇ".to_owned() + &sample_text(26, 2, 'a');
cx.set_shared_state(&content).await;
// skip over the scrolloff at the top
// test ctrl-d
cx.simulate_shared_keystrokes("4 j ctrl-d").await;
c... |
rust_dataset_chunk_506676 | rust_dataset.txt | 506,676 | 512 | .shared_state().await.assert_matches();
// Now go back to start of file, and test with vertical scroll margin
cx.simulate_shared_keystrokes("g g").await;
cx.shared_state().await.assert_matches();
cx.neovim.set_option(&format!("scrolloff={}", 3)).await;
cx.update_global(|store: ... |
rust_dataset_chunk_506677 | rust_dataset.txt | 506,677 | 512 | Context::new(cx).await;
cx.set_scroll_height(10).await;
let content = "ˇ".to_owned() + &sample_text(26, 2, 'a');
cx.set_shared_state(&content).await;
for _ in 0..8 {
cx.simulate_shared_keystrokes("ctrl-e").await;
cx.shared_state().await.assert_matches();
... |
rust_dataset_chunk_506678 | rust_dataset.txt | 506,678 | 512 | cx.shared_state().await.assert_eq("0ˇ1234567890123456789");
}
}
--- FILE: zed/crates/vim/src/normal/search.rs ---
use editor::{Editor, EditorSettings, MultiBufferOffset, SelectionEffects};
use gpui::{Action, Context, TaskExt, Window, actions};
use language::{CharKind, Point};
use schemars::JsonSchema;
use... |
rust_dataset_chunk_506679 | rust_dataset.txt | 506,679 | 512 | ")]
regex: bool,
}
/// Initiates a search operation with the specified parameters.
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
pub(crate) struct Search {
#[serde(default)]
backwards: bool,
#[serde(default = "default_true")... |
rust_dataset_chunk_506680 | rust_dataset.txt | 506,680 | 512 | .partial_word,
action.regex,
false,
window,
cx,
)
}
fn search_under_cursor_previous(
&mut self,
action: &SearchUnderCursorPrevious,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.move_to_internal(
... |
rust_dataset_chunk_506681 | rust_dataset.txt | 506,681 | 512 | , |search_bar, cx| {
if !search_bar.show(window, cx) {
return false;
}
search_bar.select_query(window, cx);
cx.focus_self(window);
search_bar.set_replacement(None, cx);
let mut options = SearchOptions::NONE;
if action.... |
rust_dataset_chunk_506682 | rust_dataset.txt | 506,682 | 512 | };
let new_selections = self.editor_selections(window, cx);
let result = pane.update(cx, |pane, cx| {
let search_bar = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>()?;
if self.search.helix_select {
search_bar.update(cx, |search_bar, cx| {
... |
rust_dataset_chunk_506683 | rust_dataset.txt | 506,683 | 512 | }
pub fn move_to_match_internal(
&mut self,
direction: Direction,
window: &mut Window,
cx: &mut Context<Self>,
) {
let Some(pane) = self.pane(window, cx) else {
return;
};
let count = Vim::take_count(cx).unwrap_or(1);
Vim::take_forced... |
rust_dataset_chunk_506684 | rust_dataset.txt | 506,684 | 512 | let display_snapshot = editor.display_snapshot(cx);
let buffer_snapshot = display_snapshot.buffer();
let selection = editor
.selections
.newest::<MultiBufferOffset>(&display_snapshot);
// A selection, such as a visual one, is used... |
rust_dataset_chunk_506685 | rust_dataset.txt | 506,685 | 512 | .start > selection.start {
editor.change_selections(
SelectionEffects::no_scroll(),
window,
cx,
|selections| {
selections.select_ranges([range.start..range.start]);
... |
rust_dataset_chunk_506686 | rust_dataset.txt | 506,686 | 512 | &mut Window, cx: &mut Context<Self>) {
let Some(pane) = self.pane(window, cx) else {
return;
};
pane.update(cx, |pane, cx| {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
let search = search_bar.update(cx, |search_b... |
rust_dataset_chunk_506687 | rust_dataset.txt | 506,687 | 512 | [range], cx);
anyhow::Ok(())
}) {
workspace.update(cx, |workspace, cx| {
result.notify_err(workspace, cx);
})
}
let Some(search_bar) = pane.update(cx, |pane, cx| {
pane.toolbar().read(cx).item_of_type::<BufferSearchBar>()
})... |
rust_dataset_chunk_506688 | rust_dataset.txt | 506,688 | 512 | editor.update(cx, |editor, cx| editor.clear_search_within_ranges(cx));
let _ = search_bar.search(&search_bar.query(cx), None, false, window, cx);
vim.update(cx, |vim, cx| {
vim.move_cursor(
Motion::StartOfLine {
... |
rust_dataset_chunk_506689 | rust_dataset.txt | 506,689 | 512 | Vim's default regex syntax escapes grouping and repetition operators,
// while Zed's regex syntax uses them unescaped.
} else if phase == 0 && matches!(c, '(' | ')' | '+' | '{' | '}') {
} else if c != delimiter {
buffer.push('\\')
}
... |
rust_dataset_chunk_506690 | rust_dataset.txt | 506,690 | 512 | !(parsed.flag_g);
}
#[gpui::test]
async fn test_replace_repetition_operators(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("ˇA12345B\nA123B\nAB").await;
cx.simulate_shared_keystrokes(&r":%s/A\([0-9]\{3\}\)B/\1/g".chars().... |
rust_dataset_chunk_506691 | rust_dataset.txt | 506,691 | 512 | cx.simulate_keystrokes("g *");
cx.run_until_parked();
cx.assert_state("hi\nˇhigh\nhi\n", Mode::Normal);
cx.simulate_keystrokes("n");
cx.assert_state("hi\nhigh\nˇhi\n", Mode::Normal);
cx.simulate_keystrokes("g #");
cx.run_until_parked();
cx.assert_state("... |
rust_dataset_chunk_506692 | rust_dataset.txt | 506,692 | 512 | c c");
let search_bar = cx.workspace(|workspace, _, cx| {
workspace
.active_pane()
.read(cx)
.toolbar()
.read(cx)
.item_of_type::<BufferSearchBar>()
.expect("Buffer search bar should be deployed")
... |
rust_dataset_chunk_506693 | rust_dataset.txt | 506,693 | 512 | cx.set_state("ˇaa\nbb\ndd\ncc\nbb\n", Mode::Normal);
cx.simulate_keystrokes("/ d");
cx.simulate_keystrokes("enter");
cx.assert_state("aa\nbb\nˇdd\ncc\nbb\n", Mode::Normal);
cx.update_editor(|editor, window, cx| {
editor.move_to_beginning(&Default::default(), window, c... |
rust_dataset_chunk_506694 | rust_dataset.txt | 506,694 | 512 | _state("aa\nbb\nˇcc\ncc\ncc\n", Mode::Normal);
cx.simulate_keystrokes("? enter");
cx.assert_state("aa\nbb\nˇcc\ncc\ncc\n", Mode::Normal);
}
#[gpui::test]
async fn test_non_vim_search(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, false).await;
cx.cx.se... |
rust_dataset_chunk_506695 | rust_dataset.txt | 506,695 | 512 | one one one", Mode::Insert);
cx.simulate_keystrokes("enter");
cx.run_until_parked();
cx.assert_state("one «oneˇ» one one", Mode::Insert);
cx.simulate_keystrokes("escape");
cx.run_until_parked();
cx.assert_state("one «oneˇ» one one", Mode::Insert);
}
#[gpui::tes... |
rust_dataset_chunk_506696 | rust_dataset.txt | 506,696 | 512 | abcd a.c. abcd").await;
cx.simulate_shared_keystrokes("v 3 l *").await;
cx.shared_state().await.assert_eq("a.c. abcd ˇa.c. abcd");
cx.set_shared_state("foo ˇbar\nbaz\nfoo bar").await;
cx.simulate_shared_keystrokes("shift-v *").await;
cx.shared_state().await.assert_eq("foo bar\n... |
rust_dataset_chunk_506697 | rust_dataset.txt | 506,697 | 512 | _eq("tmpˇ([ ([");
cx.assert_editor_background_highlights(
HighlightKey::BufferSearchHighlights,
"tmp«([» «([»",
);
// Count with both `*` and `#`.
cx.set_shared_state("tmp([ ˇ([ ([ ([").await;
cx.simulate_shared_keystrokes("2 *").await;
cx.shared_... |
rust_dataset_chunk_506698 | rust_dataset.txt | 506,698 | 512 | ).await;
cx.set_shared_state("ˇa b a b a b a").await;
cx.simulate_shared_keystrokes("*").await;
cx.simulate_shared_keystrokes("n").await;
cx.shared_state().await.assert_eq("a b a b ˇa b a");
cx.simulate_shared_keystrokes("#").await;
cx.shared_state().await.assert_eq("a b... |
rust_dataset_chunk_506699 | rust_dataset.txt | 506,699 | 512 | NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("ˇaa aa").await;
cx.simulate_shared_keystrokes("v / a a").await;
cx.simulate_shared_keystrokes("enter").await;
cx.shared_state().await.assert_eq("«aa aˇ»a");
}
#[gpui::test]
async fn test_visual_block_search(cx: &... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.