[vte] widget: Update IM cursor position after scrolling
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Update IM cursor position after scrolling
- Date: Sun, 31 Jan 2016 17:04:59 +0000 (UTC)
commit a446a5f12cac798115074f4ac4ff0bef9680c293
Author: Christian Persch <chpe gnome org>
Date: Sun Jan 31 18:01:18 2016 +0100
widget: Update IM cursor position after scrolling
https://bugzilla.gnome.org/show_bug.cgi?id=756141
src/vte.cc | 27 ++++++++++++++++++---------
src/vteinternal.hh | 1 +
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 4d03c57..75dfe58 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -4050,15 +4050,7 @@ next_match:
}
/* Tell the input method where the cursor is. */
- if (widget_realized()) {
- GdkRectangle rect;
- rect.x = m_screen->cursor.col * m_char_width + m_padding.left;
- rect.width = m_char_width; // FIXMEchpe: if columns > 1 ?
- rect.y = row_to_pixel(m_screen->cursor.row) + m_padding.top;
- rect.height = m_char_height;
- gtk_im_context_set_cursor_location(m_im_context,
- &rect);
- }
+ im_update_cursor();
_vte_debug_print (VTE_DEBUG_WORK, ")");
_vte_debug_print (VTE_DEBUG_IO,
@@ -4606,6 +4598,9 @@ VteTerminalPrivate::im_preedit_changed()
/* Invalidate again with the new cursor position */
invalidate_cursor_once();
+
+ /* And tell the input method where the cursor is on the screen */
+ im_update_cursor();
}
static gboolean
@@ -4645,6 +4640,20 @@ VteTerminalPrivate::im_delete_surrounding(int offset,
}
void
+VteTerminalPrivate::im_update_cursor()
+{
+ if (!widget_realized())
+ return;
+
+ cairo_rectangle_int_t rect;
+ rect.x = m_screen->cursor.col * m_char_width + m_padding.left;
+ rect.width = m_char_width; // FIXMEchpe: if columns > 1 ?
+ rect.y = row_to_pixel(m_screen->cursor.row) + m_padding.top;
+ rect.height = m_char_height;
+ gtk_im_context_set_cursor_location(m_im_context, &rect);
+}
+
+void
VteTerminalPrivate::widget_style_updated()
{
vte_terminal_set_font(m_terminal, m_unscaled_font_desc);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index b37ca5f..039489a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -780,6 +780,7 @@ public:
bool im_delete_surrounding(int offset,
int n_chars);
void im_reset();
+ void im_update_cursor();
bool spawn_sync(VtePtyFlags pty_flags,
const char *working_directory,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]