Introduce select_range to operation::text_input

This commit is contained in:
Remmirad 2025-04-12 12:25:39 +02:00 committed by Héctor Ramón Jiménez
parent 7a4b5d3609
commit 7c661c94be
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 46 additions and 0 deletions

View file

@ -1534,6 +1534,11 @@ impl<P: text::Paragraph> State<P> {
pub fn select_all(&mut self) {
self.cursor.select_range(0, usize::MAX);
}
/// Selects the given range of the content of the [`TextInput`].
pub fn select_range(&mut self, start: usize, end: usize) {
self.cursor.select_range(start, end);
}
}
impl<P: text::Paragraph> operation::Focusable for State<P> {
@ -1574,6 +1579,10 @@ impl<P: text::Paragraph> operation::TextInput for State<P> {
fn select_all(&mut self) {
State::select_all(self);
}
fn select_range(&mut self, start: usize, end: usize) {
State::select_range(self, start, end);
}
}
fn offset<P: text::Paragraph>(