Fix text_editor syntax highlighting on paste

Fixes #2946.
This commit is contained in:
Zero 2025-05-16 17:26:14 -04:00 committed by Héctor Ramón Jiménez
parent 6bbe189809
commit 3310dc79db
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -369,6 +369,12 @@ impl editor::Editor for Editor {
// Editing events
Action::Edit(edit) => {
let topmost_line_before_edit = editor
.selection_bounds()
.map(|(start, _)| start)
.unwrap_or_else(|| editor.cursor())
.line;
match edit {
Edit::Insert(c) => {
editor.action(
@ -417,7 +423,8 @@ impl editor::Editor for Editor {
.map(|(start, _)| start)
.unwrap_or(cursor);
internal.topmost_line_changed = Some(selection_start.line);
internal.topmost_line_changed =
Some(selection_start.line.min(topmost_line_before_edit));
}
// Mouse events