aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/textinput.rs
diff options
context:
space:
mode:
authorBehnam Esfahbod <behnam@zwnj.org>2017-05-24 01:16:19 -0500
committerBehnam Esfahbod <behnam@zwnj.org>2017-05-24 01:42:10 -0500
commit4df0ad2bc5d5fffa415dbf41815f7038fd6d82d2 (patch)
tree2283fabb2bc0992ea1beb3e1e504147c2ed631aa /components/script/textinput.rs
parentf3a694a7b442abad8af02475b944aeac7a09d539 (diff)
downloadservo-4df0ad2bc5d5fffa415dbf41815f7038fd6d82d2.tar.gz
servo-4df0ad2bc5d5fffa415dbf41815f7038fd6d82d2.zip
[script/textinput] Fix warning: unreachable pattern
The `cfg` attribute in use resulted in two match arms for two cases on `macos`. Since both arms had a main functionality in common, I merged them and conditions the extra `macos` part. ``` warning: unreachable pattern --> /Users/behnam/code/servo/servo/components/script/textinput.rs:696:13 | 696 | (None, Key::Home) => { | ^^^^^^^^^^^^^^^^^ | = note: #[warn(unreachable_patterns)] on by default warning: unreachable pattern --> /Users/behnam/code/servo/servo/components/script/textinput.rs:700:13 | 700 | (None, Key::End) => { | ^^^^^^^^^^^^^^^^ | = note: #[warn(unreachable_patterns)] on by default ```
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r--components/script/textinput.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 144be9dbd78..b508ba2806c 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -632,14 +632,6 @@ impl<T: ClipboardProvider> TextInput<T> {
self.insert_char(c);
KeyReaction::DispatchInput
},
- #[cfg(target_os = "macos")]
- (None, Key::Home) => {
- KeyReaction::RedrawSelection
- },
- #[cfg(target_os = "macos")]
- (None, Key::End) => {
- KeyReaction::RedrawSelection
- },
(None, Key::Delete) => {
self.delete_char(Direction::Forward);
KeyReaction::DispatchInput
@@ -694,12 +686,18 @@ impl<T: ClipboardProvider> TextInput<T> {
},
(None, Key::Enter) | (None, Key::KpEnter) => self.handle_return(),
(None, Key::Home) => {
- self.edit_point.index = 0;
+ #[cfg(not(target_os = "macos"))]
+ {
+ self.edit_point.index = 0;
+ }
KeyReaction::RedrawSelection
},
(None, Key::End) => {
- self.edit_point.index = self.current_line_length();
- self.assert_ok_selection();
+ #[cfg(not(target_os = "macos"))]
+ {
+ self.edit_point.index = self.current_line_length();
+ self.assert_ok_selection();
+ }
KeyReaction::RedrawSelection
},
(None, Key::PageUp) => {