Skip to content

Commit

Permalink
Put TextBox cursor back in bounds if the text changes (SecondHalfGame…
Browse files Browse the repository at this point in the history
  • Loading branch information
HexyWitch authored and Uriopass committed Jun 30, 2024
1 parent 363e16b commit 01746ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/yakui-widgets/src/widgets/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ impl Widget for TextBoxWidget {
text = &self.props.placeholder;
}

// Make sure the cursor is within bounds if the text has changed
self.cursor = self.cursor.min(text.len());

let mut render = RenderTextBox::new(text.clone());
render.style = self.props.style.clone();
render.selected = self.selected;
Expand Down

0 comments on commit 01746ef

Please sign in to comment.