From b678b2da3cef62a9f376a5ee0ef25955fcb333a7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 29 Feb 2004 02:30:37 +0000 Subject: [PATCH] Fix Page_Up and Page_Down in the completion popup to move page-wise if Sun Feb 29 03:31:42 2004 Matthias Clasen * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up and Page_Down in the completion popup to move page-wise if we're scrolling. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkentry.c | 39 ++++++++++++++++++++++++++++++++++----- 6 files changed, 64 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a103a39f9b..a2acbe0342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Feb 29 03:31:42 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up + and Page_Down in the completion popup to move page-wise if we're + scrolling. + 2004-02-28 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a103a39f9b..a2acbe0342 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sun Feb 29 03:31:42 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up + and Page_Down in the completion popup to move page-wise if we're + scrolling. + 2004-02-28 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a103a39f9b..a2acbe0342 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sun Feb 29 03:31:42 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up + and Page_Down in the completion popup to move page-wise if we're + scrolling. + 2004-02-28 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a103a39f9b..a2acbe0342 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sun Feb 29 03:31:42 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up + and Page_Down in the completion popup to move page-wise if we're + scrolling. + 2004-02-28 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a103a39f9b..a2acbe0342 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sun Feb 29 03:31:42 2004 Matthias Clasen + + * gtk/gtkentry.c (gtk_entry_completion_key_press): Fix Page_Up + and Page_Down in the completion popup to move page-wise if we're + scrolling. + 2004-02-28 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (set_cell_text_bold_if_folder): diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 981830f6dc..ab5c2c9e4c 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -4560,7 +4560,7 @@ gtk_entry_completion_key_press (GtkWidget *widget, if (keyval_is_cursor_move (event->keyval)) { GtkTreePath *path = NULL; - + if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) { completion->priv->current_selected--; @@ -4574,10 +4574,39 @@ gtk_entry_completion_key_press (GtkWidget *widget, completion->priv->current_selected = matches + actions - 1; } else if (event->keyval == GDK_Page_Up) - completion->priv->current_selected = 0; - + { + if (completion->priv->current_selected <= 0) + completion->priv->current_selected = -1; + else if (completion->priv->current_selected < matches) + { + completion->priv->current_selected -= 14; + if (completion->priv->current_selected < 0) + completion->priv->current_selected = 0; + } + else + { + completion->priv->current_selected -= 14; + if (completion->priv->current_selected < matches - 1) + completion->priv->current_selected = matches - 1; + } + } else if (event->keyval == GDK_Page_Down) - completion->priv->current_selected = matches + actions - 1; + { + if (completion->priv->current_selected < 0) + completion->priv->current_selected = 0; + else if (completion->priv->current_selected < matches - 1) + { + completion->priv->current_selected += 14; + if (completion->priv->current_selected > matches - 1) + completion->priv->current_selected = matches - 1; + } + else + { + completion->priv->current_selected += 14; + if (completion->priv->current_selected > matches + actions - 1) + completion->priv->current_selected = matches + actions - 1; + } + } if (completion->priv->current_selected < 0) { @@ -4643,7 +4672,7 @@ gtk_entry_completion_key_press (GtkWidget *widget, /* move the cursor to the end */ gtk_editable_set_position (GTK_EDITABLE (widget), -1); - g_free (str); + g_free (str); } return TRUE;