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_506500 | rust_dataset.txt | 506,500 | 512 | (
map: &DisplaySnapshot,
mut point: DisplayPoint,
times: usize,
) -> DisplayPoint {
if times > 1 {
point = map.start_of_relative_buffer_row(point, times as isize - 1);
}
end_of_line(map, false, point, 1)
}
fn window_top(
map: &DisplaySnapshot,
point: DisplayPoint,
text_layou... |
rust_dataset_chunk_506501 | rust_dataset.txt | 506,501 | 512 | ().row().0);
let new_row = DisplayRow(new_row);
let new_col = point.column().min(map.line_len(new_row));
let new_point = DisplayPoint::new(new_row, new_col);
(map.clip_point(new_point, Bias::Left), SelectionGoal::None)
} else {
(point, SelectionGoal::None)
}
}
fn window_... |
rust_dataset_chunk_506502 | rust_dataset.txt | 506,502 | 512 | possibilities = snapshot
.text_object_ranges(range, language::TreeSitterOptions::max_start_depth(4))
.filter_map(|(range, object)| {
if !matches!(object, language::TextObject::AroundFunction) {
return None;
}
let relevant = if... |
rust_dataset_chunk_506503 | rust_dataset.txt | 506,503 | 512 | Left);
if new_point == display_point {
break;
}
display_point = new_point;
}
display_point
}
fn section_motion(
map: &DisplaySnapshot,
mut display_point: DisplayPoint,
times: usize,
direction: Direction,
is_start: bool,
) -> DisplayPoint {
if map.buf... |
rust_dataset_chunk_506504 | rust_dataset.txt | 506,504 | 512 | _point = new_point;
}
return display_point;
};
for _ in 0..times {
let next_point = if is_start {
movement::start_of_excerpt(map, display_point, direction)
} else {
movement::end_of_excerpt(map, display_point, direction)
};
if next_point =... |
rust_dataset_chunk_506505 | rust_dataset.txt | 506,505 | 512 | let new_point = map.point_to_display_point(Point::new(target_row, 0), Bias::Right);
let new_point = first_non_whitespace(map, false, new_point);
if new_point == display_point {
break;
}
display_point = new_point;
}
display_point
}
#[cfg(test)]
mod test {
... |
rust_dataset_chunk_506506 | rust_dataset.txt | 506,506 | 512 | }
#[gpui::test]
async fn test_paragraph_motion_with_whitespace_lines(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// Test that whitespace-only lines are NOT treated as paragraph boundaries
// Per vim's :help paragraph - only truly empty line... |
rust_dataset_chunk_506507 | rust_dataset.txt | 506,507 | 512 |
cx.set_shared_state("ˇ{()}").await;
cx.simulate_shared_keystrokes("%").await;
cx.shared_state().await.assert_eq("{()ˇ}");
cx.simulate_shared_keystrokes("%").await;
cx.shared_state().await.assert_eq("ˇ{()}");
// test it works on immediate nesting inside braces
cx... |
rust_dataset_chunk_506508 | rust_dataset.txt | 506,508 | 512 | PT]
fn a() {
let x = 1;
}
[EXCERPT]
fn b() ˇ{
let y = 2;
}
"
});
cx.simulate_keystrokes("%");
cx.assert_excerpts_with_selections(indoc! {"
[EXCERPT]
fn a() {
... |
rust_dataset_chunk_506509 | rust_dataset.txt | 506,509 | 512 | _shared_keystrokes("%").await;
cx.shared_state().await.assert_eq("'helloˇ'");
cx.set_shared_state(indoc! {r"func (a string) {
do('somethiˇng'))
}"})
.await;
cx.simulate_shared_keystrokes("%").await;
cx.shared_state()
.await
... |
rust_dataset_chunk_506510 | rust_dataset.txt | 506,510 | 512 | (indoc! {r"ˇ/*
this is a comment
*/"})
.await;
cx.simulate_shared_keystrokes("%").await;
cx.shared_state().await.assert_eq(indoc! {r"/*
this is a comment
ˇ*/"});
cx.simulate_shared_keystrokes("%").await;
cx.shared_state().await.assert_eq(in... |
rust_dataset_chunk_506511 | rust_dataset.txt | 506,511 | 512 | #endif
ˇ#else
#endif
"});
cx.simulate_shared_keystrokes("% %").await;
cx.shared_state().await.assert_eq(indoc! {r"
ˇ#if
#if
#else
#endif
#else
#endif
"});
cx.simulate... |
rust_dataset_chunk_506512 | rust_dataset.txt | 506,512 | 512 | 2])ˇ)
}"});
cx.set_shared_state(indoc! {r"func (a string) { a((b, cˇ))}"})
.await;
cx.simulate_shared_keystrokes("] )").await;
cx.shared_state()
.await
.assert_eq(indoc! {r"func (a string) { a((b, c)ˇ)}"});
// test it works on immediate ... |
rust_dataset_chunk_506513 | rust_dataset.txt | 506,513 | 512 | cx.simulate_shared_keystrokes("[ (").await;
cx.shared_state()
.await
.assert_eq(indoc! {r"func (a string) {
doˇ(something(with<Types>.and_arrays[0, 2]))
}"});
// test it works on immediate nesting
cx.set_shared_state("{{}{} ˇ }").await;
... |
rust_dataset_chunk_506514 | rust_dataset.txt | 506,514 | 512 |
}
```
"})
.await;
cx.simulate_shared_keystrokes("] }").await;
cx.shared_state().await.assert_eq(indoc! {r"
```rs
impl Worktree {
pub async fn open_buffers(&self, path: &Path) -> impl Iterator<&Buffer> {
... |
rust_dataset_chunk_506515 | rust_dataset.txt | 506,515 | 512 |
.assert_eq(indoc! {r"<body><ˇ/body>"});
cx.simulate_shared_keystrokes("%").await;
// test jumping backwards
cx.shared_state()
.await
.assert_eq(indoc! {r"<ˇbody></body>"});
// test self-closing tags
cx.set_shared_state(indoc! {r"<a><bˇr/></a... |
rust_dataset_chunk_506516 | rust_dataset.txt | 506,516 | 512 | Binding::new(
"%",
Matching {
match_quotes: false,
},
None,
)]);
});
cx.neovim.exec("set filetype=html").await;
cx.set_shared_state(indoc! {r"<div class='teˇst' id='main'>
</div>
... |
rust_dataset_chunk_506517 | rust_dataset.txt | 506,517 | 512 |
.assert_eq(indoc! {r"<Button onClick={() => {}ˇ}></Button>"});
cx.simulate_shared_keystrokes("%").await;
cx.shared_state()
.await
.assert_eq(indoc! {r"<Button onClick=ˇ{() => {}}></Button>"});
}
#[gpui::test]
async fn test_comma_semicolon(cx: &mut gpui::... |
rust_dataset_chunk_506518 | rust_dataset.txt | 506,518 | 512 | ("one two thˇree four");
}
#[gpui::test]
async fn test_next_word_end_newline_last_char(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
let initial_state = indoc! {r"something(ˇfoo)"};
cx.set_shared_state(initial_state).await;
cx.simulate... |
rust_dataset_chunk_506519 | rust_dataset.txt | 506,519 | 512 | .assert_eq(indoc! {"
The quick browˇn
fox
jumps over the
lazy dog
"});
cx.simulate_shared_keystrokes("j j").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
fox
jumps over thˇe
l... |
rust_dataset_chunk_506520 | rust_dataset.txt | 506,520 | 512 | "abc
def
paragraph
the second
third ˇand
final"};
cx.set_shared_state(initial_state).await;
cx.simulate_shared_keystrokes("shift-h").await;
cx.shared_state().await.assert_eq(indoc! {r"abˇc
def
paragraph
the second
... |
rust_dataset_chunk_506521 | rust_dataset.txt | 506,521 | 512 | the second
third and
final"});
cx.set_shared_state(indoc! {r"
1 2 3
4 5 6
7 8 ˇ9
"})
.await;
cx.simulate_shared_keystrokes("shift-m").await;
cx.shared_state().await.assert_eq(indoc! {"
1 2 3
4 ... |
rust_dataset_chunk_506522 | rust_dataset.txt | 506,522 | 512 | }
#[gpui::test]
async fn test_window_bottom(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
let initial_state = indoc! {r"abc
deˇf
paragraph
the second
third and
final"};
cx.set_shared_state(ini... |
rust_dataset_chunk_506523 | rust_dataset.txt | 506,523 | 512 | "
1 2 3
4 5 6
7 8 9
ˇ"});
cx.set_shared_state(indoc! {r"
1 2 3
4 5 ˇ6
7 8 9
"})
.await;
cx.simulate_shared_keystrokes("9 shift-l").await;
cx.shared_state().await.assert_eq(indoc! {"
1 2 ˇ3
... |
rust_dataset_chunk_506524 | rust_dataset.txt | 506,524 | 512 | cx.simulate_shared_keystrokes("5 g e").await;
cx.shared_state().await.assert_eq(indoc! {"
123 234 345
ˇ4;5.6 567 678
789 890 901
"});
// newlines
cx.set_shared_state(indoc! {r"
123 234 345
78ˇ9 890 901
"})
.await;
... |
rust_dataset_chunk_506525 | rust_dataset.txt | 506,525 | 512 | gpui::test]
async fn test_clipping_with_inlay_hints(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {"
struct Foo {
ˇ
}
"},
Mode::Normal,
);
c... |
rust_dataset_chunk_506526 | rust_dataset.txt | 506,526 | 512 | >::new();
let new_oneˇ = this_is_a_long_name
.iter()
.map(|i| i + 1)
.map(|i| i * 2)
.collect::<Vec<_>>();
}
"},
Mode::Normal,
);
// Add type hint ... |
rust_dataset_chunk_506527 | rust_dataset.txt | 506,527 | 512 | , 0));
let inlay_text = ": i32";
let inlay = Inlay::edit_prediction(2, empty_line_start, inlay_text);
editor.splice_inlays(&[], vec![inlay], cx);
});
// Enter visual mode and move down twice
cx.simulate_keystrokes("v j j");
cx.assert_state("let a« = 1... |
rust_dataset_chunk_506528 | rust_dataset.txt | 506,528 | 512 |
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("v 5 0 %").await;
cx.shared_state().await.assert_eq(indoc! {"
The «quick brown
fox jumps over
the lazy dog
The quick brown
fox jˇ»umps over
the lazy dog
... |
rust_dataset_chunk_506529 | rust_dataset.txt | 506,529 | 512 |
πanˇotherline"})
.await;
cx.simulate_shared_keystrokes("4 backspace").await;
cx.shared_state().await.assert_eq(indoc! {"
πππˇπ
πanotherline"});
}
#[gpui::test]
async fn test_go_to_indent(cx: &mut gpui::Test... |
rust_dataset_chunk_506530 | rust_dataset.txt | 506,530 | 512 | Mode::Normal,
);
}
#[gpui::test]
async fn test_delete_key_can_remove_last_character(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("abˇc").await;
cx.simulate_shared_keystrokes("delete").await;
cx.shared_stat... |
rust_dataset_chunk_506531 | rust_dataset.txt | 506,531 | 512 |
jumped over the lazy dog"});
assert!(!cx.cx.forced_motion());
cx.set_shared_state(indoc! {"
the quick bˇrown fox
jumped over the lazy dog"})
.await;
cx.simulate_shared_keystrokes("d v g shift-m").await;
cx.shared_state().await.assert_eq(... |
rust_dataset_chunk_506532 | rust_dataset.txt | 506,532 | 512 | ˇthe quick brown fox
jumped over the lazy dog"})
.await;
cx.simulate_shared_keystrokes("d v $").await;
cx.shared_state().await.assert_eq(indoc! {"
ˇx
jumped over the lazy dog"});
assert!(!cx.cx.forced_motion());
}
#[gpui::test]
asyn... |
rust_dataset_chunk_506533 | rust_dataset.txt | 506,533 | 512 | let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
ˇthe quick brown fox
jumped over the lazy dog"})
.await;
cx.simulate_shared_keystrokes("d v e").await;
cx.shared_state().await.assert_eq(indoc! {"
ˇe ... |
rust_dataset_chunk_506534 | rust_dataset.txt | 506,534 | 512 | );
cx.set_state("ˇfoo_bar_baz", Mode::Normal);
cx.simulate_keystrokes("w");
cx.assert_state("foo_ˇbar_baz", Mode::Normal);
cx.simulate_keystrokes("w");
cx.assert_state("foo_bar_ˇbaz", Mode::Normal);
cx.set_state("ˇfooBarBaz", Mode::Normal);
cx.simulate_keystroke... |
rust_dataset_chunk_506535 | rust_dataset.txt | 506,535 | 512 | ",
super::NextSubwordEnd {
ignore_punctuation: false,
},
None,
)]);
});
cx.set_state("ˇfoo.bar", Mode::Normal);
cx.simulate_keystrokes("e");
cx.assert_state("foˇo.bar", Mode::Normal);
cx.simulate_key... |
rust_dataset_chunk_506536 | rust_dataset.txt | 506,536 | 512 | );
}
#[gpui::test]
async fn test_previous_subword_start(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// Setup custom keybindings for subword motions so we can use the bindings
// in `simulate_keystrokes`.
cx.update(|_window, cx| {
... |
rust_dataset_chunk_506537 | rust_dataset.txt | 506,537 | 512 | _state("foo;ˇbar", Mode::Normal);
cx.simulate_keystrokes("b");
cx.assert_state("ˇfoo;bar", Mode::Normal);
cx.set_state("<?php\n\n$someVariable = 2ˇ;", Mode::Normal);
cx.simulate_keystrokes("b");
cx.assert_state("<?php\n\n$someVariable = ˇ2;", Mode::Normal);
cx.simulate_k... |
rust_dataset_chunk_506538 | rust_dataset.txt | 506,538 | 512 | ulate_keystrokes("g e");
cx.assert_state("foo(baˇr)", Mode::Normal);
cx.simulate_keystrokes("g e");
cx.assert_state("fooˇ(bar)", Mode::Normal);
cx.simulate_keystrokes("g e");
cx.assert_state("foˇo(bar)", Mode::Normal);
cx.set_state("foo_bar_baˇz", Mode::Normal);
... |
rust_dataset_chunk_506539 | rust_dataset.txt | 506,539 | 512 | hunks are expanded, the deleted line from the diff base
// appears in the MultiBuffer. The method motion should correctly
// navigate to the second function even with this extra content.
cx.simulate_keystrokes("] m");
cx.assert_editor_state(indoc! {r#"
fn first() {
... |
rust_dataset_chunk_506540 | rust_dataset.txt | 506,540 | 512 | _hunks(&editor::actions::ExpandAllDiffHunks, window, cx);
});
// The first `] /` (vim::NextComment) should go to the end of the first
// comment.
cx.simulate_keystrokes("] /");
cx.assert_editor_state(indoc! {r#"
// first commenˇt
fn first() {
... |
rust_dataset_chunk_506541 | rust_dataset.txt | 506,541 | 512 | fn change_motion(
&mut self,
motion: Motion,
times: Option<usize>,
forced_motion: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
// Some motions ignore failure when switching to normal mode
let mut motion_kind = if matches!(
motion... |
rust_dataset_chunk_506542 | rust_dataset.txt | 506,542 | 512 | });
if let Some(kind) = motion_kind {
vim.copy_selections_content(editor, kind, window, cx);
editor.delete_selections_with_linked_edits(window, cx);
editor.refresh_edit_prediction(
true,
... |
rust_dataset_chunk_506543 | rust_dataset.txt | 506,543 | 512 | : "cw" when on a blank
// followed by other blanks changes only the first blank; this is probably a
// bug, because "dw" deletes all the blanks}
fn expand_changed_word_selection(
map: &DisplaySnapshot,
selection: &mut Selection<DisplayPoint>,
times: Option<usize>,
ignore_punctuation: bool,
text_layo... |
rust_dataset_chunk_506544 | rust_dataset.txt | 506,544 | 512 | {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate("c h", "Teˇst").await.assert_matches();
cx.simulate("c h", "Tˇest").await.assert_matches();
cx.simulate("c h", "ˇTest").await.assert_matches();
cx.simulate(
"c h",
indoc! {"
Te... |
rust_dataset_chunk_506545 | rust_dataset.txt | 506,545 | 512 | )
.await
.assert_matches();
cx.simulate(
"c w",
indoc! {"
Test test
ˇ
test"},
)
.await
.assert_matches();
cx.simulate("c shift-w", "Test teˇst-test test")
.await
... |
rust_dataset_chunk_506546 | rust_dataset.txt | 506,546 | 512 | "Teˇst Test").await.assert_matches();
cx.simulate("c b", "Test ˇtest").await.assert_matches();
cx.simulate("c b", "Test1 test2 ˇtest3")
.await
.assert_matches();
cx.simulate(
"c b",
indoc! {"
Test test
ˇtest"},
... |
rust_dataset_chunk_506547 | rust_dataset.txt | 506,547 | 512 | indoc! {"
The quick
brown fox
jumps ˇover"},
)
.await
.assert_matches();
cx.simulate(
"c k",
indoc! {"
The qˇuick
brown fox
jumps over"},
)
.await
.assert_matches();
... |
rust_dataset_chunk_506548 | rust_dataset.txt | 506,548 | 512 | shift-g",
indoc! {"
The quick
brownˇ fox
jumps over
the lazy"},
)
.await
.assert_matches();
cx.simulate(
"c shift-g",
indoc! {"
The quick
brown fox
jumps over
... |
rust_dataset_chunk_506549 | rust_dataset.txt | 506,549 | 512 | oc! {"
ˇ
brown fox
jumps over
the lazy"},
)
.await
.assert_matches();
}
#[gpui::test]
async fn test_repeated_cj(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
for count in 1..=5 {... |
rust_dataset_chunk_506550 | rust_dataset.txt | 506,550 | 512 | await;
for count in 1..=5 {
cx.simulate_at_each_offset(
&format!("c {count} e"),
indoc! {"
ˇThe quˇickˇ browˇn
ˇ
ˇfox ˇjumpsˇ-ˇoˇver
ˇthe lazy dog
"},
)
... |
rust_dataset_chunk_506551 | rust_dataset.txt | 506,551 | 512 | mut Window,
cx: &mut Context<Self>,
) {
self.stop_recording(cx);
self.update_editor(cx, |_, editor, cx| {
editor.set_clip_at_line_ends(false, cx);
let text_layout_details = editor.text_layout_details(window, cx);
editor.transact(window, cx, |editor, window... |
rust_dataset_chunk_506552 | rust_dataset.txt | 506,552 | 512 | Effects::no_scroll(), window, cx, |s| {
s.move_with(&mut |map, selection| {
object.expand_selection(map, selection, around, times);
original_positions.insert(
selection.id,
map.display_point_to_an... |
rust_dataset_chunk_506553 | rust_dataset.txt | 506,553 | 512 | mut Window,
cx: &mut Context<Self>,
) {
self.manipulate_text(window, cx, |c| {
vec![match c {
'A'..='M' | 'a'..='m' => ((c as u8) + 13) as char,
'N'..='Z' | 'n'..='z' => ((c as u8) - 13) as char,
_ => c,
}]
})
}
... |
rust_dataset_chunk_506554 | rust_dataset.txt | 506,554 | 512 | cursor_positions.push(selection.start..selection.start);
} else {
ranges.push(selection.start..selection.end);
cursor_positions.push(selection.start..selection.end);
}
... |
rust_dataset_chunk_506555 | rust_dataset.txt | 506,555 | 512 | .shared_state().await.assert_eq("a😀CˇDé1*F\n");
// works with multibyte characters
cx.simulate_shared_keystrokes("~").await;
cx.set_shared_state("aˇC😀é1*F\n").await;
cx.simulate_shared_keystrokes("4 ~").await;
cx.shared_state().await.assert_eq("ac😀É1ˇ*F\n");
// works... |
rust_dataset_chunk_506556 | rust_dataset.txt | 506,556 | 512 | Context) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// works in visual mode
cx.set_shared_state("A😀c«DÉ1*fˇ»\n").await;
cx.simulate_shared_keystrokes("u").await;
cx.shared_state().await.assert_eq("A😀cˇdé1*f\n");
// works with line selections
cx.set_... |
rust_dataset_chunk_506557 | rust_dataset.txt | 506,557 | 512 | await;
cx.set_shared_state("abc dˇef\n").await;
cx.simulate_shared_keystrokes("g shift-u i w").await;
cx.shared_state().await.assert_eq("abc ˇDEF\n");
}
#[gpui::test]
async fn test_convert_to_rot13(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(c... |
rust_dataset_chunk_506558 | rust_dataset.txt | 506,558 | 512 | nop qrs");
}
#[gpui::test]
async fn test_change_rot13_object(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("ˇabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
.await;
cx.simulate_shared_keystrokes("g ? i w... |
rust_dataset_chunk_506559 | rust_dataset.txt | 506,559 | 512 | use editor::{
Bias, DisplayPoint, EditPredictionRequestTrigger,
display_map::{DisplaySnapshot, ToDisplayPoint},
};
use gpui::{Context, Window};
use language::{Point, Selection};
use multi_buffer::MultiBufferRow;
impl Vim {
pub fn delete_motion(
&mut self,
motion: Motion,
times: Opti... |
rust_dataset_chunk_506560 | rust_dataset.txt | 506,560 | 512 | _selections_with_linked_edits(window, cx);
// Fixup cursor position after the deletion
editor.set_clip_at_line_ends(true, cx);
editor.change_selections(Default::default(), window, cx, |s| {
s.move_with(&mut |map, selection| {
l... |
rust_dataset_chunk_506561 | rust_dataset.txt | 506,561 | 512 | Bias::Left);
if selection.start.row().0 > 0 {
should_move_to_start.insert(selection.id);
selection.start =
(start - '\n'.len_utf8()).to_display_point(map);
... |
rust_dataset_chunk_506562 | rust_dataset.txt | 506,562 | 512 | *column;
cursor = map
.buffer_snapshot()
.clip_point(cursor_point, Bias::Left)
.to_display_point(map);
}
cursor = map.clip_point(cursor, Bias::Left... |
rust_dataset_chunk_506563 | rust_dataset.txt | 506,563 | 512 | (cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate(
"d w",
indoc! {"
Test tesˇt
test"},
)
.await
.assert_matches();
cx.simulate("d w", "Teˇst").await.assert_matches();
... |
rust_dataset_chunk_506564 | rust_dataset.txt | 506,564 | 512 | _matches();
cx.simulate("d b", "Test1 test2 ˇtest3")
.await
.assert_matches();
cx.simulate(
"d b",
indoc! {"
Test test
ˇtest"},
)
.await
.assert_matches();
cx.simulate(
"d b",
... |
rust_dataset_chunk_506565 | rust_dataset.txt | 506,565 | 512 | #[gpui::test]
async fn test_delete_k(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate(
"d k",
indoc! {"
The quick
brown ˇfox
jumps over"},
)
.await
.assert_matches();... |
rust_dataset_chunk_506566 | rust_dataset.txt | 506,566 | 512 | cx.simulate(
"d shift-g",
indoc! {"
The quick
brownˇ fox
jumps over
the lazy"},
)
.await
.assert_matches();
cx.simulate(
"d shift-g",
indoc! {"
The quick
brown ... |
rust_dataset_chunk_506567 | rust_dataset.txt | 506,567 | 512 | assert_matches();
cx.simulate(
"d g g",
indoc! {"
ˇ
brown fox
jumps over
the lazy"},
)
.await
.assert_matches();
}
#[gpui::test]
async fn test_cancel_delete_operator(cx: &mut gpui::TestAppContext) {
... |
rust_dataset_chunk_506568 | rust_dataset.txt | 506,568 | 512 | {"
the ˇlazy dog"});
cx.set_shared_state(indoc! {"
The ˇquick brown
fox jumps over
the moon,
a star, and
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("2 d 2 d").await;
cx.shared_state()... |
rust_dataset_chunk_506569 | rust_dataset.txt | 506,569 | 512 | : zed/crates/vim/src/normal/increment.rs ---
use editor::{Editor, MultiBufferSnapshot, ToOffset, ToPoint};
use gpui::{Action, Context, Window};
use language::{Bias, Point};
use schemars::JsonSchema;
use serde::Deserialize;
use std::ops::Range;
use crate::{Vim, state::Mode};
const BOOLEAN_PAIRS: &[(&str, &str)] = &[("... |
rust_dataset_chunk_506570 | rust_dataset.txt | 506,570 | 512 | (cx);
for selection in editor.selections.all_adjusted(&editor.display_snapshot(cx)) {
if !selection.is_empty()
&& (vim.mode != Mode::VisualBlock || new_anchors.is_empty())
{
new_anchors.push((true, snapshot.anchor_before(selection.start... |
rust_dataset_chunk_506571 | rust_dataset.txt | 506,571 | 512 | negative, delta, num_str) = match num.strip_prefix('-') {
Some(n) => (true, -delta, n),
None => (false, delta, num),
};
let num_length = num_str.len();
let leading_zero = num_str.starts_with('0');
let (result, new_negative) = match u64::from_str_radix(num_str, 10) {
Ok(value) =>... |
rust_dataset_chunk_506572 | rust_dataset.txt | 506,572 | 512 | };
format!("{:0width$b}", result, width = num.len())
}
fn find_target(
snapshot: &MultiBufferSnapshot,
start: Point,
end: Point,
need_range: bool,
) -> Option<(Range<Point>, String, u32)> {
let start_offset = start.to_offset(snapshot);
let end_offset = end.to_offset(snapshot);
let mut... |
rust_dataset_chunk_506573 | rust_dataset.txt | 506,573 | 512 | }
}
pre_char.insert(0, ch);
}
// The backward scan breaks on whitespace, including newlines. Without this
// skip, the forward scan would start on the newline and immediately break
// (since it also breaks on newlines), finding nothing on the current line.
if let Some(c... |
rust_dataset_chunk_506574 | rust_dataset.txt | 506,574 | 512 | = None;
target = String::new();
} else if ch.is_digit(radix)
|| ((begin.is_none() || !is_num)
&& ch == '-'
&& chars.peek().is_some()
&& chars.peek().unwrap().is_digit(radix))
{
if !is_num {
is_num = true... |
rust_dataset_chunk_506575 | rust_dataset.txt | 506,575 | 512 | increment_toggle_string(boolean: &str) -> String {
let lower = boolean.to_lowercase();
let target = BOOLEAN_PAIRS
.iter()
.find_map(|(a, b)| {
if lower == *a {
Some(b)
} else if lower == *b {
Some(a)
} else {
N... |
rust_dataset_chunk_506576 | rust_dataset.txt | 506,576 | 512 | let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
1ˇ.2
"})
.await;
cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state().await.assert_eq(indoc! {"
1.ˇ3
"});
cx.simulate_share... |
rust_dataset_chunk_506577 | rust_dataset.txt | 506,577 | 512 | &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
099ˇ9
"})
.await;
cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state().await.assert_eq(indoc! {"
100ˇ0
... |
rust_dataset_chunk_506578 | rust_dataset.txt | 506,578 | 512 | await.assert_eq(indoc! {"
00ˇ0
"});
cx.simulate_shared_keystrokes("ctrl-x").await;
cx.shared_state().await.assert_eq(indoc! {"
-00ˇ1
"});
cx.simulate_shared_keystrokes("2 ctrl-a").await;
cx.shared_state().await.assert_eq(ind... |
rust_dataset_chunk_506579 | rust_dataset.txt | 506,579 | 512 | cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state().await.assert_eq(indoc! {"
0x0000fffffffffffffffˇf
"});
cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state().await.assert_eq(indoc! {"
0x0000000000000000000ˇ0
... |
rust_dataset_chunk_506580 | rust_dataset.txt | 506,580 | 512 | cx.set_shared_state(indoc! {"
inline0x3ˇ9u32
"})
.await;
cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state().await.assert_eq(indoc! {"
inline0x3ˇau32
"});
cx.simulate_shared_keystrok... |
rust_dataset_chunk_506581 | rust_dataset.txt | 506,581 | 512 | (cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
ˇ1
1
1 2
1
1"})
.await;
cx.simulate_shared_keystrokes("j v shift-g g ctrl-a").await;
cx.shared_s... |
rust_dataset_chunk_506582 | rust_dataset.txt | 506,582 | 512 | _matches();
}
#[gpui::test]
async fn test_increment_toggle(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state("let enabled = trˇue;", Mode::Normal);
cx.simulate_keystrokes("ctrl-a");
cx.assert_state("let enabled = falsˇe;", Mode:... |
rust_dataset_chunk_506583 | rust_dataset.txt | 506,583 | 512 | -a");
cx.assert_state("aaa truˇe 1 2 3", Mode::Normal);
cx.set_state("aaˇa 1 false 2 3", Mode::Normal);
cx.simulate_keystrokes("ctrl-a");
cx.assert_state("aaa ˇ2 false 2 3", Mode::Normal);
cx.set_state("trueˇ 1 2 3", Mode::Normal);
cx.simulate_keystrokes("ctrl-a");
... |
rust_dataset_chunk_506584 | rust_dataset.txt | 506,584 | 512 | rokes("j").await;
cx.shared_state()
.await
.assert_eq("# Title\n2. item\nˇ2. item\n3. item");
cx.simulate_shared_keystrokes("ctrl-a").await;
cx.shared_state()
.await
.assert_eq("# Title\n2. item\nˇ3. item\n3. item");
cx.simulate_shared_keys... |
rust_dataset_chunk_506585 | rust_dataset.txt | 506,585 | 512 | selection behavior.
pub(crate) fn store_visual_marks(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self.mode.is_visual() {
self.create_visual_marks(self.mode, window, cx);
}
}
pub(crate) fn create_visual_marks(
&mut self,
mode: Mode,
windo... |
rust_dataset_chunk_506586 | rust_dataset.txt | 506,586 | 512 | (cx, |editor, cx| {
let map = editor.snapshot(window, cx);
let mut ranges: Vec<Range<Anchor>> = Vec::new();
for mut anchor in anchors {
if line {
let mut point = anchor.to_display_point(&map.display_snapshot);
... |
rust_dataset_chunk_506587 | rust_dataset.txt | 506,587 | 512 | : Arc<str>,
line: bool,
should_pop_operator: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
if should_pop_operator {
self.pop_operator(window, cx);
}
let mark = self
.update_editor(cx, |vim, editor, cx| {
vim.get... |
rust_dataset_chunk_506588 | rust_dataset.txt | 506,588 | 512 | s.select_anchor_ranges(ranges)
});
}
});
if should_jump && let Some(anchor) = anchor {
self.motion(Motion::Jump { anchor, line }, window, cx)
}
}
}
pub fn set_mark(
&mut self,
... |
rust_dataset_chunk_506589 | rust_dataset.txt | 506,589 | 512 | )?.entity_id();
globals
.marks
.get_mut(&workspace_id)?
.update(cx, |ms, cx| ms.get_mark(name, editor.buffer(), cx))
})
}
pub fn delete_mark(
&self,
name: String,
editor: &mut Editor,
window: &mut Window,
... |
rust_dataset_chunk_506590 | rust_dataset.txt | 506,590 | 512 | m '").await;
cx.shared_state().await.assert_eq("Hello, worldˇ!");
cx.simulate_shared_keystrokes("^ ` `").await;
cx.shared_state().await.assert_eq("Hello, worldˇ!");
}
#[gpui::test]
async fn test_global_mark_overwrite(cx: &mut TestAppContext) {
let mut cx = VimTestContext::n... |
rust_dataset_chunk_506591 | rust_dataset.txt | 506,591 | 512 | ToOffset,
display_map::ToDisplayPoint, movement,
};
use gpui::{Action, Context, Window};
use language::{Bias, SelectionGoal};
use schemars::JsonSchema;
use serde::Deserialize;
use settings::Settings;
use std::cmp;
use text::LineEnding;
use vim_mode_setting::HelixModeSetting;
use crate::{
Vim,
motion::{Mot... |
rust_dataset_chunk_506592 | rust_dataset.txt | 506,592 | 512 | from vim block mode,
// pasting it will paste it on subsequent lines, even if you don't yet
// have a cursor there.
let mut selections_to_process = Vec::new();
let mut i = 0;
while i < current_selections.len() {
selecti... |
rust_dataset_chunk_506593 | rust_dataset.txt | 506,593 | 512 | let line_mode = to_insert.ends_with('\n');
let is_multiline = to_insert.contains('\n');
if line_mode && !before {
if selection.is_empty() {
to_insert =
"\n".to_owned() + &to_insert[..to_insert.l... |
rust_dataset_chunk_506594 | rust_dataset.txt | 506,594 | 512 | .push(original_indent_column);
}
// Record anchors before applying edits to track pasted text start.
// anchor_before(start) stays before inserted text (for `[` mark).
let buffer_snapshot = editor.buffer().read(cx).snapshot(cx);
let mark_s... |
rust_dataset_chunk_506595 | rust_dataset.txt | 506,595 | 512 | the end if the first line is blank).
// otherwise vim will insert the next text at (or before) the current cursor position,
// the cursor will go to the last (or first, if is_multiline) inserted character.
editor.change_selections(Default::default(), window, cx, |s| {
... |
rust_dataset_chunk_506596 | rust_dataset.txt | 506,596 | 512 | ')),
cx,
);
return;
};
editor.insert(&text, window, cx);
editor.set_clip_at_line_ends(true, cx);
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s... |
rust_dataset_chunk_506597 | rust_dataset.txt | 506,597 | 512 | , UseSystemClipboard};
#[gpui::test]
async fn test_paste(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// single line
cx.set_shared_state(indoc! {"
The quick brown
fox ˇjumps over
the lazy dog"})
.a... |
rust_dataset_chunk_506598 | rust_dataset.txt | 506,598 | 512 | cx.simulate_shared_keystrokes("v j y").await;
cx.shared_clipboard().await.assert_eq("over\nthe lazy do");
cx.simulate_shared_keystrokes("p").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
fox jumps oˇover
the lazy dover
... |
rust_dataset_chunk_506599 | rust_dataset.txt | 506,599 | 512 | over
the lazy dog"},
Mode::Normal,
);
cx.simulate_keystrokes("v i w y");
cx.assert_state(
indoc! {"
The quick brown
fox ˇjumps over
the lazy dog"},
Mode::Normal,
);
cx.simulate_ke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.