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


Message #26 received at 28936 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 28936 <at> debbugs.gnu.org
Subject: Re: nRe: bug#28936: move_it_in_display_line_to returns
 MOVE_POS_MATCH_OR_ZV before ZV
Date: Sun, 22 Oct 2017 22:41:14 +0300
> Date:  Sun, 22 Oct 2017 12:22:26 -0700
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  28936 <at> debbugs.gnu.org
> 
> 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".

There's something you didn't tell, because otherwise what you describe
is done all the time by the display engine, and it is certainly
incorrect that it's impossible to get to a given X coordinate, with or
without word-wrap.

It is possible that you didn't reset current_x before the iteration,
or that the window-start point is not where you think it is.  Or
something else.  This code works, it's the workhorse of many Emacs
display operations.

> The code that I borrowed is from xdisp.c at approximately 22680:  "while (it.current_x + it.pixel_width <= target_x".

That doesn't mean anything: the code you copied tries to find the
character _before_ target_x, whereas you are trying to get to target_x
itself.




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.