gtk_container_add (GTK_CONTAINER (priv->abook_button), abook_icon);
priv->text_view = gtk_text_view_new ();
+ /* Auto-capitalization is the default, so let's turn it off: */
+ hildon_gtk_text_view_set_input_mode (GTK_TEXT_VIEW (priv->text_view),
+ HILDON_GTK_INPUT_MODE_FULL);
+
priv->recipients = NULL;
priv->scrolled_window = modest_scroll_text_new (GTK_TEXT_VIEW (priv->text_view), 1024);
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;
}
GtkTextIter prev;
gunichar prev_char;
ModestRecptEditorPrivate *priv = MODEST_RECPT_EDITOR_GET_PRIVATE (editor);
+
+ if (len > 1024)
+ len = 1024;
if (!is_valid_insert (text, len)) {
gchar *new_text = create_valid_text (text, len);
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:
*/
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:
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);