Skip to content

Commit

Permalink
Move to end of text are when focus changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PoignardAzur committed Jan 14, 2025
1 parent 599f9b1 commit 27e713e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion masonry/src/widget/text_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,13 @@ impl<const EDITABLE: bool> Widget for TextArea<EDITABLE> {

fn update(&mut self, ctx: &mut UpdateCtx, event: &Update) {
match event {
Update::FocusChanged(_) => {
Update::FocusChanged(focus) => {
// If we lose focus, set the selection up so that next time
// we get focus, selection will be at the end of the text.
if !*focus {
let (fctx, lctx) = ctx.text_contexts();
self.editor.driver(fctx, lctx).move_to_text_end();
}
ctx.request_render();
}
Update::DisabledChanged(_) => {
Expand Down

0 comments on commit 27e713e

Please sign in to comment.