Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion graphics/src/text/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
Loading