Skip to content

Commit

Permalink
Reset single-line TextBox scroll position on focus loss
Browse files Browse the repository at this point in the history
- closes #1125
- progress on #1652
  • Loading branch information
cmyr committed Mar 29, 2021
1 parent 11e4bc2 commit 93cc27a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions druid/src/widget/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ impl<T: TextStorage + EditableText> Widget<T> for TextBox<T> {
ctx.invalidate_text_input(druid_shell::text::Event::SelectionChanged);
}
self.inner.wrapped_mut().child_mut().has_focus = false;
if !self.multiline {
self.inner.wrapped_mut().scroll_to(Rect::ZERO);
}
self.cursor_timer = TimerToken::INVALID;
self.was_focused_from_click = false;
ctx.request_paint();
Expand Down

0 comments on commit 93cc27a

Please sign in to comment.