diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-09-15 16:26:01 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-09-17 13:31:11 +0200 |
commit | 34d9a6091b07d7a57ede438f5467faf3fedfa6ae (patch) | |
tree | f2bc5a78cd141688106110fe89611eece568fbda /components/script/textinput.rs | |
parent | 4a53c873f5587601c28798785df4b8f61475abf4 (diff) | |
download | servo-34d9a6091b07d7a57ede438f5467faf3fedfa6ae.tar.gz servo-34d9a6091b07d7a57ede438f5467faf3fedfa6ae.zip |
script: Ask layout to redraw the selection whenever the user moves the
caret in an input element.
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 8330b19f01f..0adffc77d34 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -49,6 +49,7 @@ pub struct TextInput<T: ClipboardProvider> { pub enum KeyReaction { TriggerDefaultAction, DispatchInput, + RedrawSelection, Nothing, } @@ -366,7 +367,7 @@ impl<T: ClipboardProvider> TextInput<T> { match key { Key::A if is_control_key(mods) => { self.select_all(); - KeyReaction::Nothing + KeyReaction::RedrawSelection }, Key::C if is_control_key(mods) => { if let Some(text) = self.get_selection_text() { @@ -397,36 +398,36 @@ impl<T: ClipboardProvider> TextInput<T> { } Key::Left => { self.adjust_horizontal_by_one(Direction::Backward, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::Right => { self.adjust_horizontal_by_one(Direction::Forward, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::Up => { self.adjust_vertical(-1, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::Down => { self.adjust_vertical(1, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::Enter | Key::KpEnter => self.handle_return(), Key::Home => { self.edit_point.index = 0; - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::End => { self.edit_point.index = self.current_line_length(); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::PageUp => { self.adjust_vertical(-28, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::PageDown => { self.adjust_vertical(28, maybe_select); - KeyReaction::Nothing + KeyReaction::RedrawSelection } Key::Tab => KeyReaction::TriggerDefaultAction, _ => KeyReaction::Nothing, |