GNOME Bugzilla – Bug 756141
im cursor location not updated on viewport scroll
Last modified: 2016-03-15 04:32:21 UTC
Produce more than a screenful of output. Switch to "Japanese (Anthy) (IBus)" keyboard layout. Scroll back with the scrollbar a bit. Press a letter or two, followed by two spaces, so that a popup window containing several kanjis appear. Notice that this window is incorrectly positioned vertically, as if you didn't scroll back the viewport. gtk_im_context_set_cursor_location() is now only called from vte_terminal_process_incoming(), should also be called when scroll_delta changes.
Also, the horizontal position takes neither preedit_cursor, nor the amount by which it's shifted to the left (see bug 755668) into account.
I believe that this bug also occurs when the cursor is on the last line of the terminal and one presses enter. Pressing enter causes the terminal content to scroll down one line but the coordinates that ibus receives are now outside the terminal window.
Created attachment 319542 [details] [review] Patch for vte.cc The patch calls gtk_im_context_set_cursor_location() if the preedit is changed.
I don't think updating the IM's cursor position during ::draw is the right place. I've committed a patch that factors out the update, and call that when the preddit string changes. Still need to add a call when the scroll_delta changes, I think.
The integrated patch does not take the preedit length. My patch is: rect.x = m_screen->cursor.col * m_char_width + m_padding.left + get_preedit_width(false) * m_char_width; To reproduce, launch ibus-setup and select "Hide automatically" in "Show property panel" and then you could see the difference between gtk and vte.
--- a/src/vte.cc +++ b/src/vte.cc @@ -4647,7 +4647,8 @@ VteTerminalPrivate::im_update_cursor() return; cairo_rectangle_int_t rect; - rect.x = m_screen->cursor.col * m_char_width + m_padding.left; + rect.x = m_screen->cursor.col * m_char_width + m_padding.left + + get_preedit_width(false) + m_char_width; 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; Actually current patch fixes the scroll_delta change too, I think.
Created attachment 320603 [details] [review] Patch for vte.cc Updated the patch.
> get_preedit_width(false) + m_char_width That should have been '*' not '+', right? Committed with that change.
(In reply to Christian Persch from comment #8) > > get_preedit_width(false) + m_char_width > > That should have been '*' not '+', right? Committed with that change. You're right. Thank you for the fix.