mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gtktextview: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard) the IM context is reset somewhat early, before the actual change took place. This makes IM lag behind in terms of surrounding text and cursor position. Shuffle these IM reset calls so that they happen after the changes, and ensure that the IM is actually reset, since that is currently toggled on a pretty narrow set of circumstances. Also, fix a bug during GtkEventControllerKey::im-update where the condition on cursor position editability to reset the IM context was inverted.
This commit is contained in:
parent
9e29739e66
commit
52ac71b972
@ -5533,7 +5533,7 @@ gtk_text_view_key_controller_im_update (GtkEventControllerKey *controller,
|
||||
can_insert = gtk_text_iter_can_insert (&iter, priv->editable);
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
if (!can_insert)
|
||||
if (can_insert)
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
@ -6366,8 +6366,6 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
if (step == GTK_MOVEMENT_PAGES)
|
||||
{
|
||||
if (!gtk_text_view_scroll_pages (text_view, count, extend_selection))
|
||||
@ -6551,6 +6549,9 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
|
||||
gtk_text_view_check_cursor_blink (text_view);
|
||||
gtk_text_view_pend_cursor_blink (text_view);
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6841,14 +6842,16 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
if (type == GTK_DELETE_CHARS)
|
||||
{
|
||||
/* Char delete deletes the selection, if one exists */
|
||||
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
|
||||
priv->editable))
|
||||
return;
|
||||
{
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
|
||||
@ -6975,6 +6978,9 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (text_view));
|
||||
}
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6985,12 +6991,14 @@ gtk_text_view_backspace (GtkTextView *text_view)
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
/* Backspace deletes the selection, if one exists */
|
||||
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
|
||||
priv->editable))
|
||||
return;
|
||||
{
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
|
||||
&insert,
|
||||
@ -7003,6 +7011,9 @@ gtk_text_view_backspace (GtkTextView *text_view)
|
||||
DV(g_print (G_STRLOC": scrolling onscreen\n"));
|
||||
gtk_text_view_scroll_mark_onscreen (text_view,
|
||||
gtk_text_buffer_get_insert (get_buffer (text_view)));
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user