1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-15 19:31:29 -07:00

Fix crashes with completion and composed characters.

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.
This commit is contained in:
Eli Zaretskii 2011-08-23 11:38:29 +03:00
parent 1a2e6670cf
commit 425cc014ac
2 changed files with 7 additions and 1 deletions

View 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.

View 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