[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: vertical-motion fails when tab in line]
From: |
Chong Yidong |
Subject: |
Re: address@hidden: vertical-motion fails when tab in line] |
Date: |
Tue, 13 Jun 2006 11:04:57 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> There's a bug in `vertical-motion' which will cause it to move the
> point not to the beginning of the next (visual) line when called
> with argument 1, but just a few characters to the right in the
> current line. This occurs iff there is a Tab in the line.
>
> To reproduce, take a scratch buffer, enter a few lines of text wich
> will be wrapped and contain one (or more?) tabs. Place cursor near
> the end of a wrapped line, but not too far towards the end, and call
> M-: (vertical-motion 1).
The problem here is that in Fvertical_motion line 2092, after we call
reseat_at_previous_visible_line_start (&it), the value of
it.continuation_lines_width is not reset to zero. This screws up the
calculation of tab stops if it.continuation_lines_width is non-zero
and there are tabs present in the continued line.
One solution is to reset it->continuation lines_width to zero in
reseat_at_previous_visible_line_start (and probably
reseat_at_next_visible_line_start too.) This seems like the proper
fix, but I'd like to get some confirmation from people more familiar
with redisplay:
*** emacs/src/xdisp.c.~1.1102.~ 2006-06-12 23:38:55.000000000 -0400
--- emacs/src/xdisp.c 2006-06-13 11:01:42.000000000 -0400
***************
*** 5119,5124 ****
--- 5119,5125 ----
struct it *it;
{
back_to_previous_visible_line_start (it);
+ it->continuation_lines_width = 0;
reseat (it, it->current.pos, 1);
CHECK_IT (it);
}
A more limited fix is to simply set it.continuation_lines_width to
zero in Fvertical_motion, which should solve the particular problem
reported:
*** emacs/src/indent.c.~1.183.~ 2006-06-12 23:38:55.000000000 -0400
--- emacs/src/indent.c 2006-06-13 10:50:01.000000000 -0400
***************
*** 2089,2095 ****
start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE
|| it.method == GET_FROM_STRETCH);
reseat_at_previous_visible_line_start (&it);
! it.current_x = it.hpos = 0;
/* Temporarily disable selective display so we don't move too far */
oselective = it.selective;
it.selective = 0;
--- 2089,2095 ----
start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE
|| it.method == GET_FROM_STRETCH);
reseat_at_previous_visible_line_start (&it);
! it.current_x = it.hpos = it.continuation_lines_width = 0;
/* Temporarily disable selective display so we don't move too far */
oselective = it.selective;
it.selective = 0;