1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Clamp text cursor positions in the same places where we used to (#7081)

Closes #7077.

This fixes the problem shown in #7077 where clearing a `TextEdit`
wouldn't reset its cursor position. I've fixed that by adding back the
`TextCursorState::range` method, which clamps the selection range to
that of the passed `Galley`, and calling it in the same places where it
was called before #5785.

(/cc @juancampa)

* [x] I have followed the instructions in the PR template
This commit is contained in:
valadaptive
2025-06-15 19:53:00 -04:00
committed by GitHub
parent df2c16ef0a
commit 54fded362d
4 changed files with 24 additions and 10 deletions

View File

@@ -1104,6 +1104,10 @@ impl Galley {
}
}
pub fn clamp_cursor(&self, cursor: &CCursor) -> CCursor {
self.cursor_from_layout(self.layout_from_cursor(*cursor))
}
pub fn cursor_up_one_row(
&self,
cursor: &CCursor,