summaryrefslogtreecommitdiff
path: root/gtk/gtktextlayout.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-06-05 23:04:49 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-06-05 23:04:49 +0000
commit6bbdea92f7d888b4e6d212655d97756545b514fa (patch)
treeec9ec3b649200ddad6517abdd0967431dd4e8559 /gtk/gtktextlayout.c
parent4d5b395f2c8b8ad765727114397f1291c13195dd (diff)
downloadgtk+-6bbdea92f7d888b4e6d212655d97756545b514fa.tar.gz
#80023, Yao Zhang, TOKUNAGA Hiroyuki
Thu Jun 5 16:12:54 2003 Owen Taylor <otaylor@redhat.com> #80023, Yao Zhang, TOKUNAGA Hiroyuki * gtk/gtktextlayout.c (gtk_text_layout_get_cursor_locations): Account for the preedit cursor offset if the iter passed in is at the same place as the insertion cursor. * gtk/gtktextview.c (gtk_text_view_get_cursor_location): Encapsulate getting the insertion cursor location. * gtk/gtktextview.c (gtk_text_view_update_im_spot_location): Pass the real y/height to the IM context. Take text_view->x/yoffset into account.
Diffstat (limited to 'gtk/gtktextlayout.c')
-rw-r--r--gtk/gtktextlayout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index dead7b8f7b..99414521bc 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -2188,6 +2188,7 @@ gtk_text_layout_get_cursor_locations (GtkTextLayout *layout,
GtkTextLineDisplay *display;
gint line_top;
gint index;
+ GtkTextIter insert_iter;
PangoRectangle pango_strong_pos;
PangoRectangle pango_weak_pos;
@@ -2202,6 +2203,13 @@ gtk_text_layout_get_cursor_locations (GtkTextLayout *layout,
line_top = _gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
line, layout);
+ gtk_text_buffer_get_iter_at_mark (layout->buffer, &insert_iter,
+ gtk_text_buffer_get_mark (layout->buffer,
+ "insert"));
+
+ if (gtk_text_iter_equal (iter, &insert_iter))
+ index += layout->preedit_cursor - layout->preedit_len;
+
pango_layout_get_cursor_pos (display->layout, index,
strong_pos ? &pango_strong_pos : NULL,
weak_pos ? &pango_weak_pos : NULL);