1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Fix: dragging to above/below a TextEdit or Label will select text to begin/end (#3858)

This also adds a `Galley::begin` method to match `Galley::end` (both
returning cursor positions).

* Part of https://github.com/emilk/egui/issues/3816
This commit is contained in:
Emil Ernerfeldt
2024-01-22 10:49:42 +01:00
committed by GitHub
parent d319489479
commit ff39fd6195
4 changed files with 60 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
//! Different types of text cursors, i.e. ways to point into a [`super::Galley`].
/// Character cursor
/// Character cursor.
///
/// The default cursor is zero.
#[derive(Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct CCursor {
@@ -110,9 +112,12 @@ impl PartialEq for PCursor {
}
/// All different types of cursors together.
///
/// They all point to the same place, but in their own different ways.
/// pcursor/rcursor can also point to after the end of the paragraph/row.
/// Does not implement `PartialEq` because you must think which cursor should be equivalent.
///
/// The default cursor is the zero-cursor, to the first character.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Cursor {