bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces


From: martin rudalics
Subject: bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces
Date: Sat, 9 Jan 2021 18:07:36 +0100

> The problematic code appears to be here in window-text-pixel-size:
>
> else if (EQ (from, Qt))
>    {
>      start = BEGV;
>      bpos = BEGV_BYTE;
>      while (bpos < ZV_BYTE)
>        {
> c = fetch_char_advance (&start, &bpos);
> if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
>    break;
>        }
>      while (bpos > BEGV_BYTE)
>        {
> dec_both (&start, &bpos);
> c = FETCH_BYTE (bpos);
> if (!(c == ' ' || c == '\t'))
>    break;
>        }
>    }
>
> The second loop looks like it's attempting to backtrack to the
> beginning of the line, but FETCH_BYTE (bpos) after a dec_both returns
> the same character that the first loop ended on. In other words, start
> and bpos are not in sync, or the way that FETCH_BYTE works is
> different. If I subtract 1 from bpos when calling FETCH_BYTE, it works
> as expected.

Do you mean the first dec_both skips too much or not enough?  That code
was broken when I wrote it initially, someone fixed the char/byte issue
later and now I'm too silly to understand it.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]