Introduce select_range to operation::text_input
This commit is contained in:
parent
7a4b5d3609
commit
7c661c94be
2 changed files with 46 additions and 0 deletions
|
|
@ -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>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue