fix: route normal-mode cuts through clipboard pipeline

This commit is contained in:
2026-10-17 00:46:22 +02:00
parent b9f29d258c
commit d8be35e3bd
7 changed files with 103 additions and 23 deletions
+6 -16
View File
@@ -368,7 +368,6 @@ enum EditStart {
target: char,
selector: SelectionIntent,
},
Delete,
Join,
Paste {
after: bool,
@@ -8657,21 +8656,16 @@ impl Editor {
);
}
Action::Delete => {
if self.active.view.mode == Mode::Normal {
self.edit_normal(action, 1);
return None;
}
if self.active.view.mode == Mode::Insert && self.edit_snippet("", Some(action)) {
return None;
}
let before = (self.active.view.mode != Mode::Insert).then(|| self.snapshot());
let mask = self.deletion_mask(None);
self.delete_forward(&mask);
if let Some(before) = before {
self.record_native(
before,
EditRecipe {
start: EditStart::Delete,
steps: Vec::new(),
},
);
} else if mask.iter().any(|active| *active) {
if mask.iter().any(|active| *active) {
self.push_insert_step(InsertStep::Delete(mask));
}
}
@@ -10689,7 +10683,7 @@ impl Editor {
Action::DeleteWordBackward | Action::ChangeWordBackward => {
self.word_destination(cursor, Action::DeleteWordBackward, count)
}
Action::SubstituteCharacter => Cursor {
Action::Delete | Action::SubstituteCharacter => Cursor {
row: cursor.row,
column: cursor
.column
@@ -11537,10 +11531,6 @@ impl Editor {
self.normalize_targets();
}
}
EditStart::Delete => {
self.active.view.mode = Mode::Normal;
self.delete_forward(&[true]);
}
EditStart::Join => {
self.active.view.mode = Mode::Normal;
self.join_lines();
+2 -2
View File
@@ -25,7 +25,7 @@ Files: Space o floating tree INSERT; Space e docked tree NORMAL (right by defaul
i filters; Esc retains filter and returns NORMAL, then editor; Ctrl+u clears in either mode
Ctrl+t view, Ctrl+w close, Ctrl+r refresh
Normal: i/a insert, I/A insert at first nonblank/end, o/O new line
h/j/k/l move, 0/$ line ends, x delete, J join lines
h/j/k/l move, 0/$ line ends, x/Delete cut hovered graphemes, J join lines
w/b/e word next/previous/end, W/B/E whitespace-delimited WORDs
Normal/Visual: f<char>/F<char> seek next/previous on current line; 2fx seeks second x
gf follows Markdown file links/reference links and heading fragments (no LSP)
@@ -43,7 +43,7 @@ Normal: i/a insert, I/A insert at first nonblank/end, o/O new line
Linewise p/P paste below/above the current row; characterwise p/P paste after/before the grapheme
Normal/Visual: . repeats last native edit at current targets (one undo group)
v characterwise select, V linewise select, p/P paste fragments, Ctrl+k/Ctrl+e clone above/below
y/d/c/p/P use the system clipboard by default; config.clipboard_mode = \"separate\" isolates it
y/d/x/c/p/P use the system clipboard by default; config.clipboard_mode = \"separate\" isolates it
Esc keeps only the primary caret
Visual: motions extend selections, y copy, d/x/Delete cut, c change, p/P replace selections
: opens command input with the selection preserved; Esc returns to that selection