unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41125: 28.0.50; Fwindow_text_pixel_size uses FETCH_CHAR (charpos)
@ 2020-05-07 11:55 Pip Cet
  2020-05-07 13:36 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Pip Cet @ 2020-05-07 11:55 UTC (permalink / raw)
  To: 41125

Fwindow_text_pixel_size contains this code:

      start = pos = BEGV;
      while ((pos++ < ZV) && (c = FETCH_CHAR (pos))
         && (c == ' ' || c == '\t' || c == '\n' || c == '\r'))
    start = pos;
      while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) && (c == ' ' ||
c == '\t'))
    start = pos;

which cannot possibly be correct: FETCH_CHAR takes a byte position,
not a character position, but BEGV and ZV are measured in characters.

(I'm familiarizing myself with the xdisp.c code, partly by replacing
bytepos/charpos pairs of variables with a combined pos_t type
variable. I think that's a good idea partly because it would prevent
precisely this kind of bug.)





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-08 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 11:55 bug#41125: 28.0.50; Fwindow_text_pixel_size uses FETCH_CHAR (charpos) Pip Cet
2020-05-07 13:36 ` Eli Zaretskii
2020-05-08  7:18   ` martin rudalics
2020-05-08 10:37     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).