GNU bug report logs - #28936
move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Sun, 22 Oct 2017 03:04:01 UTC

Severity: normal

Tags: wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 28936 <at> debbugs.gnu.org
Subject: bug#28936: move_it_in_display_line_to returns MOVE_POS_MATCH_OR_ZV before ZV
Date: Sun, 22 Oct 2017 21:30:45 +0300
> Date:  Sun, 22 Oct 2017 11:05:45 -0700
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  28936 <at> debbugs.gnu.org
> 
> Thank you, Eli, for looking into #28936.

I don't think there's any bug here.

> 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




This bug report was last modified 6 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.