vim: Add test for helix selection duplication issue

This commit is contained in:
Florian Plattner 2026-05-21 17:37:17 +02:00
parent bc41407a5e
commit 3342d27003
No known key found for this signature in database

View file

@ -147,6 +147,8 @@ fn display_point_range_to_offset_range(
#[cfg(test)]
mod tests {
use db::indoc;
use gpui::{AppContext, UpdateGlobal};
use settings::SettingsStore;
use crate::{state::Mode, test::VimTestContext};
@ -310,4 +312,50 @@ mod tests {
Mode::HelixNormal,
);
}
#[gpui::test]
async fn test_selection_duplication_softwrap(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.enable_helix();
cx.update_global(|settings: &mut SettingsStore, cx| {
settings.update_user_settings(cx, |settings| {
settings.project.all_languages.defaults.soft_wrap =
Some(settings::SoftWrap::Bounded);
settings
.project
.all_languages
.defaults
.preferred_line_length = Some(8);
});
});
cx.set_state(
indoc! {"
The quick brown
foˇx jumps over the
lazy dog."},
Mode::HelixNormal,
);
cx.simulate_keystrokes("C");
cx.assert_state(
indoc! {"
The quick brown
foˇx jumps over the
laˇzy dog."},
Mode::HelixNormal,
);
cx.simulate_keystrokes("alt-C");
cx.assert_state(
indoc! {"
Thˇe quick brown
foˇx jumps over the
laˇzy dog."},
Mode::HelixNormal,
);
}
}