Index: pango/pango-layout.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-layout.c,v
retrieving revision 1.147
diff -u -p -r1.147 pango-layout.c
--- pango/pango-layout.c	17 Nov 2005 08:02:08 -0000	1.147
+++ pango/pango-layout.c	17 Nov 2005 13:01:35 -0000
@@ -1422,11 +1422,14 @@ pango_layout_move_cursor_visually (Pango
 
   vis2log_map = pango_layout_line_get_vis2log_map (line, strong);
 
+  log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index,
+				      layout->text + line->start_index + vis2log_map[vis_pos]);
   do
     {
-      vis_pos += direction > 0 ? 1 : -1;
-      log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index,
-					  layout->text + line->start_index + vis2log_map[vis_pos]);
+      int move = direction > 0 ? 1 : -1;
+      log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index + vis2log_map[vis_pos],
+					  layout->text + line->start_index + vis2log_map[vis_pos + move]);
+      vis_pos += move;
     }
   while (vis_pos > 0 && vis_pos < n_vis &&
 	 !layout->log_attrs[start_offset + log_pos].is_cursor_position);
