1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-29 11:02:01 +00:00

Fix bug #11653 with cursor positioning in a row that has only strings.

src/xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.  If
 all the glyphs of the glyph row came from strings, and we have no
 cursor positioning clues, put the cursor on the first glyph of the
 row.
This commit is contained in:
Eli Zaretskii 2012-06-16 12:57:56 +03:00
parent 771e3eae1e
commit 2f07e6afc9
2 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2012-06-16 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (set_cursor_from_row): Don't dereference glyphs_end. If
all the glyphs of the glyph row came from strings, and we have no
cursor positioning clues, put the cursor on the first glyph of the
row. (Bug#11653)
2012-06-16 Andreas Schwab <schwab@linux-m68k.org>
* category.h (CHAR_HAS_CATEGORY): Define as inline.

View File

@ -14260,6 +14260,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
the cursor is not on this line. */
if (cursor == NULL
&& (row->reversed_p ? glyph <= end : glyph >= end)
&& (row->reversed_p ? end > glyphs_end : end < glyphs_end)
&& STRINGP (end->object)
&& row->continued_p)
return 0;
@ -14289,6 +14290,21 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
compute_x:
if (cursor != NULL)
glyph = cursor;
else if (glyph == glyphs_end
&& pos_before == pos_after
&& STRINGP ((row->reversed_p
? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
: row->glyphs[TEXT_AREA])->object))
{
/* If all the glyphs of this row came from strings, put the
cursor on the first glyph of the row. This avoids having the
cursor outside of the text area in this very rare and hard
use case. */
glyph =
row->reversed_p
? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
: row->glyphs[TEXT_AREA];
}
if (x < 0)
{
struct glyph *g;