X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-recpt-editor.c;h=357c1bd2fa3e2aaad08f0c0db696603b9a304b3f;hb=7691e2bcadbe4e08be6afac44ed922681dbb6b6f;hp=5e66325d9842e0a1f99e92d7ac5a8a0fb12d25f0;hpb=e8aad45ec1a2effcce0d858a0ea66fb0b34ba988;p=modest diff --git a/src/widgets/modest-recpt-editor.c b/src/widgets/modest-recpt-editor.c index 5e66325..357c1bd 100644 --- a/src/widgets/modest-recpt-editor.c +++ b/src/widgets/modest-recpt-editor.c @@ -44,6 +44,12 @@ #include #include +/* FIXNE: we should have no maemo-deps in widgets/ */ +#ifdef MODEST_PLATFORM_MAEMO +#include "maemo/modest-hildon-includes.h" +#endif /*MODEST_PLATFORM_MAEMO*/ + + static GObjectClass *parent_class = NULL; #define RECIPIENT_TAG_ID "recpt-id" @@ -334,8 +340,10 @@ modest_recpt_editor_instance_init (GTypeInstance *instance, gpointer g_class) priv->text_view = gtk_text_view_new (); /* Auto-capitalization is the default, so let's turn it off: */ +#ifdef MAEMO_CHANGES hildon_gtk_text_view_set_input_mode (GTK_TEXT_VIEW (priv->text_view), HILDON_GTK_INPUT_MODE_FULL); +#endif priv->recipients = NULL; @@ -435,7 +443,11 @@ modest_recpt_editor_on_button_release_event (GtkWidget *widget, selection_changed = TRUE; } - gtk_text_buffer_select_range (buffer, &start, &end); + if (selection_changed) { + gtk_text_buffer_select_range (buffer, &start, &end); + } else { + GTK_TEXT_VIEW (priv->text_view)->pending_place_cursor_button = 0; + } return FALSE; } @@ -679,12 +691,14 @@ modest_recpt_editor_on_key_press_event (GtkTextView *text_view, ModestRecptEditor *editor) { GtkTextMark *insert; + GtkTextMark *selection; GtkTextBuffer * buffer; - GtkTextIter location; + GtkTextIter location, selection_loc; GtkTextTag *tag; buffer = gtk_text_view_get_buffer (text_view); insert = gtk_text_buffer_get_insert (buffer); + selection = gtk_text_buffer_get_selection_bound (buffer); /* cases to cover: * * cursor is on resolved recipient: @@ -706,6 +720,7 @@ modest_recpt_editor_on_key_press_event (GtkTextView *text_view, */ gtk_text_buffer_get_iter_at_mark (buffer, &location, insert); + gtk_text_buffer_get_iter_at_mark (buffer, &selection_loc, selection); switch (key->keyval) { case GDK_Left: @@ -775,7 +790,12 @@ modest_recpt_editor_on_key_press_event (GtkTextView *text_view, case GDK_Return: case GDK_KP_Enter: { + gint insert_offset, selection_offset; + insert_offset = gtk_text_iter_get_offset (&location); + selection_offset = gtk_text_iter_get_offset (&selection_loc); g_signal_handlers_block_by_func (buffer, modest_recpt_editor_on_insert_text, editor); + if (selection_offset > insert_offset) + location = selection_loc; tag = iter_has_recipient (&location); if (tag != NULL) { gtk_text_buffer_get_end_iter (buffer, &location);