aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-completion-match.c4
-rw-r--r--widgets/text/e-completion-view.c31
2 files changed, 30 insertions, 5 deletions
diff --git a/widgets/text/e-completion-match.c b/widgets/text/e-completion-match.c
index 19a0980516..45c54ccce3 100644
--- a/widgets/text/e-completion-match.c
+++ b/widgets/text/e-completion-match.c
@@ -96,13 +96,13 @@ e_completion_match_set_text (ECompletionMatch *match,
if (match_text == NULL) {
match_text = "Unknown_Match";
- } else if (! g_utf8_validate (match_text, 0, NULL)) {
+ } else if (! g_utf8_validate (match_text, -1, NULL)) {
match_text = "Invalid_UTF8";
}
if (menu_text == NULL) {
menu_text = match_text;
- } else if (! g_utf8_validate (menu_text, 0, NULL)) {
+ } else if (! g_utf8_validate (menu_text, -1, NULL)) {
menu_text = "Invalid_UTF8";
}
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
index 400494623e..06f6428fd4 100644
--- a/widgets/text/e-completion-view.c
+++ b/widgets/text/e-completion-view.c
@@ -452,16 +452,28 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
{
ECompletionView *cv = E_COMPLETION_VIEW (user_data);
gint dir = 0;
- gboolean key_handled = TRUE;
+ gboolean key_handled = TRUE, complete_key = FALSE, uncomplete_key = FALSE;
+
+ /* FIXME: This is totally lame.
+ The ECompletionView should be able to specify multiple completion/uncompletion keys, or just
+ have sensible defaults. */
+
+ if ((cv->complete_key && key_event->keyval == cv->complete_key)
+ || ((key_event->keyval == GDK_n || key_event->keyval == GDK_N) && (key_event->state & GDK_CONTROL_MASK)))
+ complete_key = TRUE;
+
+ if ((cv->uncomplete_key && key_event->keyval == cv->uncomplete_key)
+ || ((key_event->keyval == GDK_p || key_event->keyval == GDK_P) && (key_event->state & GDK_CONTROL_MASK)))
+ uncomplete_key = TRUE;
/* Start up a completion.*/
- if (cv->complete_key && key_event->keyval == cv->complete_key && !cv->editable) {
+ if (complete_key && !cv->editable) {
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], NULL);
goto stop_emission;
}
/* Stop our completion. */
- if (cv->uncomplete_key && key_event->keyval == cv->uncomplete_key && cv->editable && cv->selection < 0) {
+ if (uncomplete_key && cv->editable && cv->selection < 0) {
e_completion_view_set_cursor_row (cv, -1);
gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
goto stop_emission;
@@ -471,11 +483,24 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
return FALSE;
switch (key_event->keyval) {
+
+ case GDK_n:
+ case GDK_N:
+ /* We (heart) emacs: treat ctrl-n as down */
+ if (! (key_event->state & GDK_CONTROL_MASK))
+ return FALSE;
+
case GDK_Down:
case GDK_KP_Down:
dir = 1;
break;
+ case GDK_p:
+ case GDK_P:
+ /* Treat ctrl-p as up */
+ if (! (key_event->state & GDK_CONTROL_MASK))
+ return FALSE;
+
case GDK_Up:
case GDK_KP_Up:
dir = -1;