]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crashes with completion and composed characters.
authorEli Zaretskii <eliz@gnu.org>
Tue, 23 Aug 2011 08:38:29 +0000 (11:38 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 23 Aug 2011 08:38:29 +0000 (11:38 +0300)
 src/dispnew.c (buffer_posn_from_coords): Use buf_charpos_to_bytepos
 instead of CHAR_TO_BYTE.  Fixes a crash when a completion
 candidate is selected by the mouse, and that candidate has a
 composed character under the mouse.

src/ChangeLog
src/dispnew.c

index ffb8dd76366bda0f52084363e4ac9ad25383ed80..d4f654a1028249b092d1bea5e7ad52b5f5cc0194 100644 (file)
@@ -1,5 +1,10 @@
 2011-08-23  Eli Zaretskii  <eliz@gnu.org>
 
+       * dispnew.c (buffer_posn_from_coords): Use buf_charpos_to_bytepos
+       instead of CHAR_TO_BYTE.  Fixes a crash when a completion
+       candidate is selected by the mouse, and that candidate has a
+       composed character under the mouse.
+
        * xdisp.c (x_produce_glyphs): Set it->nglyphs to 1.  Fixes pixel
        coordinates reported by pos-visible-in-window-p for a composed
        character in column zero.
index fadfbb2660327778706a0361cd9e260cc6b0af61..e2bcf5d7090def91c821b11f9ff871bdaab0b7a1 100644 (file)
@@ -5307,7 +5307,8 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
       if (STRINGP (it.string))
        BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos));
       else
-       BYTEPOS (pos->pos) = CHAR_TO_BYTE (CHARPOS (pos->pos));
+       BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->buffer),
+                                                    CHARPOS (pos->pos));
     }
 
 #ifdef HAVE_WINDOW_SYSTEM