Fix bug #17539 with infinite recursion during scroll commands.

src/xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
 when closest_pos is identical to to_charpos, don't recurse, since
 we already tried that, and failed.
This commit is contained in:
Eli Zaretskii 2014-05-21 18:03:18 +03:00
parent b0df8b9535
commit 5e2e0fa456
2 changed files with 17 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2014-05-21 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
when closest_pos is identical to to_charpos, don't recurse, since
we already tried that, and failed. (Bug#17539)
2014-05-20 Eli Zaretskii <eliz@gnu.org>
* w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are

View file

@ -8812,8 +8812,11 @@ move_it_in_display_line_to (struct it *it,
if (closest_pos < ZV)
{
RESTORE_IT (it, &ppos_it, ppos_data);
move_it_in_display_line_to (it, closest_pos, -1,
MOVE_TO_POS);
/* Don't recurse if closest_pos is equal to
to_charpos, since we have just tried that. */
if (closest_pos != to_charpos)
move_it_in_display_line_to (it, closest_pos, -1,
MOVE_TO_POS);
result = MOVE_POS_MATCH_OR_ZV;
}
else
@ -8874,8 +8877,9 @@ move_it_in_display_line_to (struct it *it,
&& !at_eob_p && closest_pos < ZV)
{
RESTORE_IT (it, &ppos_it, ppos_data);
move_it_in_display_line_to (it, closest_pos, -1,
MOVE_TO_POS);
if (closest_pos != to_charpos)
move_it_in_display_line_to (it, closest_pos, -1,
MOVE_TO_POS);
}
result = MOVE_POS_MATCH_OR_ZV;
break;
@ -8893,7 +8897,9 @@ move_it_in_display_line_to (struct it *it,
if (closest_pos < ZV)
{
RESTORE_IT (it, &ppos_it, ppos_data);
move_it_in_display_line_to (it, closest_pos, -1, MOVE_TO_POS);
if (closest_pos != to_charpos)
move_it_in_display_line_to (it, closest_pos, -1,
MOVE_TO_POS);
}
result = MOVE_POS_MATCH_OR_ZV;
break;