Merge pull request #2947 from Atreyagaurav/master

Fix `text_editor` syntax highlighting on paste
This commit is contained in:
Héctor 2025-11-26 00:22:11 +01:00 committed by GitHub
commit 992cf0a23f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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