[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: |
Aaron Jensen |
Subject: |
bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces |
Date: |
Sat, 9 Jan 2021 11:44:46 -0600 |
On Sat, Jan 9, 2021 at 11:07 AM martin rudalics <rudalics@gmx.at> wrote:
> 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.
It doesn't skip enough. I believe this fixes both the leading and
trailing space problems:
diff --git a/src/xdisp.c b/src/xdisp.c
index 6a4304d194..20e7ca3a1e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10652,7 +10652,10 @@ DEFUN ("window-text-pixel-size",
Fwindow_text_pixel_size, Swindow_text_pixel_siz
{
c = fetch_char_advance (&start, &bpos);
if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
- break;
+ {
+ dec_both (&start, &bpos);
+ break;
+ }
}
while (bpos > BEGV_BYTE)
{
@@ -10680,12 +10683,17 @@ DEFUN ("window-text-pixel-size",
Fwindow_text_pixel_size, Swindow_text_pixel_siz
{
dec_both (&end, &bpos);
c = FETCH_BYTE (bpos);
if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
- break;
+ {
+ inc_both (&end, &bpos);
+ break;
+ }
}
while (bpos < ZV_BYTE)
{
c = fetch_char_advance (&end, &bpos);
if (!(c == ' ' || c == '\t'))
break;
}
The problem is that the first loop leaves the pointer pointing to the
next character and it's only back tracked once.
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, martin rudalics, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces,
Aaron Jensen <=
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Eli Zaretskii, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/09
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, martin rudalics, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, martin rudalics, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, martin rudalics, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/10
- bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces, Aaron Jensen, 2021/01/12