fix(helix): Making d and c work as expected in normal mode

This commit is contained in:
Levi Santos 2025-03-28 22:47:10 -03:00 committed by CJ van den Berg
parent e669849629
commit 0babbb1833
2 changed files with 10 additions and 3 deletions

View file

@ -146,8 +146,8 @@
["a", ["move_right"], ["enter_mode", "insert"]],
["o", ["smart_insert_line_after"], ["enter_mode", "insert"]],
["d", "cut"],
["c", ["cut"], ["enter_mode", "insert"]],
["d", "cut_forward_internal"],
["c", ["cut_forward_internal"], ["enter_mode", "insert"]],
["s", "select_regex"],
[";", "collapse_selections"],

View file

@ -2495,7 +2495,14 @@ pub const Editor = struct {
continue;
}
with_selection_const(root, move, cursel, self.metrics) catch continue;
switch (tui.get_selection_style()) {
.inclusive => {
const sel = try cursel.enable_selection(root, self.metrics);
cursel.cursor = sel.end;
cursel.check_selection(root, self.metrics);
},
else => with_selection_const(root, move, cursel, self.metrics) catch continue,
}
const cut_text, root = self.cut_selection(root, cursel) catch continue;
if (first) {