Skip to content

Commit

Permalink
Update text_cursor_state.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Dec 18, 2024
1 parent ce5fdc6 commit 25a8ee9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/egui/src/text_selection/text_cursor_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ impl TextCursorState {
true
} else if response.sense.drag {
if response.hovered() && ui.input(|i| i.pointer.any_pressed()) {
// Preserves the text cursor position when right-clicking.
if ui.input(|i| i.pointer.secondary_down()) {
return true;
}

// The start of a drag (or a click).
if ui.input(|i| i.modifiers.shift) {
if let Some(mut cursor_range) = self.range(galley) {
Expand Down

0 comments on commit 25a8ee9

Please sign in to comment.