Skip to content

Commit

Permalink
select all text when dragvalue gets focus (emilk#2650)
Browse files Browse the repository at this point in the history
  • Loading branch information
lictex committed Feb 5, 2023
1 parent 7afd4ad commit 9ee7b42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/egui/src/widgets/drag_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ impl<'a> Widget for DragValue<'a> {
mem.drag_value.edit_string = None;
mem.request_focus(id);
});
let mut state = TextEdit::load_state(ui.ctx(), id).unwrap_or_default();
state.set_ccursor_range(Some(text::CCursorRange::two(
epaint::text::cursor::CCursor::default(),
epaint::text::cursor::CCursor::new(value_text.chars().count()),
)));
state.store(ui.ctx(), response.id);
} else if response.dragged() {
ui.ctx().set_cursor_icon(CursorIcon::ResizeHorizontal);

Expand Down

0 comments on commit 9ee7b42

Please sign in to comment.