[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28936: nRe: bug#28936: move_it_in_display_line_to returns MOVE_POS_M
From: |
Keith David Bershatsky |
Subject: |
bug#28936: nRe: bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV |
Date: |
Sun, 22 Oct 2017 12:22:26 -0700 |
The issue is observable at a distance of approximately up to five (5) text
characters prior to ZV, rather than a distance of just one (1) it->pixel_width.
And, the issue is only present when word-wrap is non-nil. In the example of a
buffer containing only "Hello world!", the wrong result is observable on the
letter "w", and on the letter "o", and on the letter "r" and on the letter "l",
and on the letter "d", and on the exclamation point. If my recollection is
collect when trying out the example, the wrong result was also observable on
the space between "hello" and "world".
The code that I borrowed is from xdisp.c at approximately 22680: "while
(it.current_x + it.pixel_width <= target_x".
I am running out the door for a few hours, and can try changing the while loop
condition when I return -- however, I am fairly confident that copying the code
at 22680 for this particular use case is what is needed.
Thanks,
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATE: [10-22-2017 11:30:45] <22 Oct 2017 21:30:45 +0300>
FROM: Eli Zaretskii <eliz@gnu.org>
>
> * * *
>
> > With respect to `move_it_in_display_line`, I was not able to reliably land
> > on `it.first_visible_x + lnum_pixel_width` when horizontal scrolling to the
> > right AND text truncated on the left. IT overshoots the target by one text
> > character.
>
> This means you have an off-by-one error, probably because you are
> not computing the target X coordinate correctly. The mistake I show
> below is probably the same mistake you do elsewhere.
>
> > while (it->current_x + it->pixel_width <= target_x
>
> This condition will cause the iterator to attempt to get to the
> character _after_ point, where it will hit ZV. So what you see, viz.:
>
> > STEP #5: Observe that the result is "1" when it should be "2".
>
> is expected. You should change the condition to this:
>
> while (it->current_x < target_x
- bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV, Keith David Bershatsky, 2017/10/21
- bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV, Keith David Bershatsky, 2017/10/22
- bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV, Eli Zaretskii, 2017/10/22
- bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV, Keith David Bershatsky, 2017/10/22
- bug#28936: nRe: bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV,
Keith David Bershatsky <=
- bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV, Keith David Bershatsky, 2017/10/23
- bug#28936: enhancement request: remove vertical scroll bar automatically when not needed, Keith David Bershatsky, 2017/10/24
- bug#28936: enhancement request: remove vertical scroll bar automatically when not needed, Keith David Bershatsky, 2017/10/25