Skip to content

Commit

Permalink
Put TextBox cursor back in bounds if the text changes (#168) (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
HexyWitch authored Jun 18, 2024
1 parent add78a7 commit a91e91d
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 a91e91d

Please sign in to comment.