Skip to content

Commit

Permalink
Implement Page(Up|Down) functionality for TextInput.
Browse files Browse the repository at this point in the history
  • Loading branch information
ema-fox committed Dec 6, 2014
1 parent 2ec16a0 commit f99c0e2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/script/textinput.rs
Expand Up @@ -163,9 +163,9 @@ impl TextInput {
self.edit_point.index = 0;
self.edit_point.line = 0;
return;
} else if adjust > 0 && self.edit_point.line >= self.lines.len() - adjust as uint {
self.edit_point.index = self.current_line_length();
} else if adjust > 0 && self.edit_point.line + adjust as uint >= self.lines.len() {
self.edit_point.line = self.lines.len() - 1;
self.edit_point.index = self.current_line_length();
return;
}

Expand Down Expand Up @@ -268,6 +268,14 @@ impl TextInput {
self.edit_point.index = self.current_line_length();
Nothing
}
"PageUp" => {
self.adjust_vertical(-28);
Nothing
}
"PageDown" => {
self.adjust_vertical(28);
Nothing
}
"Tab" => TriggerDefaultAction,
_ => Nothing,
}
Expand Down

0 comments on commit f99c0e2

Please sign in to comment.