refactor: move modal paste policy into editor input

This commit is contained in:
Valdemar Lorenzen
2026-10-05 14:30:40 +02:00
parent 73b15f5134
commit 01805bba0e
4 changed files with 110 additions and 23 deletions
+2 -5
View File
@@ -21,7 +21,7 @@ use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use crate::{
editor::{Editor, Effect, Input, Mode},
editor::{Editor, Input, Mode},
session::EditorSession,
};
@@ -75,10 +75,7 @@ pub fn run(session: &mut EditorSession) -> io::Result<()> {
session.handle(input);
}
}
// Bracketed paste must never execute pasted Ex commands.
Event::Paste(text) if session.editor().mode() == Mode::Insert => {
session.apply(vec![Effect::Insert(text)]);
}
Event::Paste(text) => session.handle(Input::Paste(text)),
_ => {}
}
}