diff options
4 files changed, 32 insertions, 17 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 93e60ef..20609db 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -446,15 +446,16 @@ void AutocompleteEditViewGtk::HandleViewMoveCursor( GtkMovementStep step, gint count, gboolean extendion_selection) { - // Handle up / down cursor movement on our own. - if (step == GTK_MOVEMENT_DISPLAY_LINES) { - model_->OnUpOrDownKeyPressed(count); - // move-cursor doesn't use a signal accumulator on the return value (it - // just ignores them), so we have to stop the propagation. - g_signal_stop_emission_by_name(text_view_, "move-cursor"); - return; - } - // Propagate into GtkTextView. + // Handle up/down/pgup/pgdn movement on our own. + int move_amount = count; + if (step == GTK_MOVEMENT_PAGES) + move_amount = model_->result().size() * ((count < 0) ? -1 : 1); + else if (step != GTK_MOVEMENT_DISPLAY_LINES) + return; // Propagate into GtkTextView + model_->OnUpOrDownKeyPressed(move_amount); + // move-cursor doesn't use a signal accumulaqtor on the return value (it + // just ignores then), so we have to stop the propagation. + g_signal_stop_emission_by_name(text_view_, "move-cursor"); } gboolean AutocompleteEditViewGtk::HandleViewSizeRequest(GtkRequisition* req) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index 19f4b31..521f590 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -83,7 +83,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView { virtual bool OnAfterPossibleChange(); // Helper functions which forward to our private: model_. - void OnUpOrDownKeyPressed(int dir); + void OnUpOrDownKeyPressed(bool up, bool by_page); void OnEscapeKeyPressed(); void OnSetFocus(bool f); void OnKillFocus(); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 854f3dc..40e212b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -261,8 +261,9 @@ bool AutocompleteEditViewMac::OnAfterPossibleChange() { return something_changed; } -void AutocompleteEditViewMac::OnUpOrDownKeyPressed(int dir) { - model_->OnUpOrDownKeyPressed(dir); +void AutocompleteEditViewMac::OnUpOrDownKeyPressed(bool up, bool by_page) { + int count = by_page ? model_->result().size() : 1; + model_->OnUpOrDownKeyPressed(up ? -count : count); } void AutocompleteEditViewMac::OnEscapeKeyPressed() { model_->OnEscapeKeyPressed(); @@ -295,12 +296,22 @@ void AutocompleteEditViewMac::FocusLocation() { - (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)cmd { if (cmd == @selector(moveDown:)) { - edit_view_->OnUpOrDownKeyPressed(1); + edit_view_->OnUpOrDownKeyPressed(false, false); return YES; } if (cmd == @selector(moveUp:)) { - edit_view_->OnUpOrDownKeyPressed(-1); + edit_view_->OnUpOrDownKeyPressed(true, false); + return YES; + } + + if (cmd == @selector(scrollPageDown:)) { + edit_view_->OnUpOrDownKeyPressed(false, true); + return YES; + } + + if (cmd == @selector(scrollPageUp:)) { + edit_view_->OnUpOrDownKeyPressed(true, true); return YES; } diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 95a71b9..a51dbaa 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -1649,14 +1649,17 @@ bool AutocompleteEditViewWin::OnKeyDownOnlyWritable(TCHAR key, NEW_FOREGROUND_TAB : CURRENT_TAB, false); return true; - case VK_UP: - count = -count; + case VK_PRIOR: + case VK_NEXT: + count = model_->result().size(); // FALL THROUGH + case VK_UP: case VK_DOWN: if (flags & KF_ALTDOWN) return false; - model_->OnUpOrDownKeyPressed(count); + model_->OnUpOrDownKeyPressed(((key == VK_PRIOR) || (key == VK_UP)) ? + -count : count); return true; // Hijacking Editing Commands |