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: Aaron Jensen
Subject: bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces
Date: Sat, 9 Jan 2021 20:56:35 -0600

On Sat, Jan 9, 2021 at 12:14 PM Eli Zaretskii <eliz@gnu.org> wrote:
> Yes, probably.
>
> But before we do any changes here, we need a test suite.  Would you
> mind adding the necessary tests to test/src/xdisp-tests.el?

Okay, I added a few basic tests for this case. I don't know if that's
the best way to test it, but it's what I could figure out.

The implementation bypasses the extra backtrack for the FROM, but the
algorithm for the TO is the same as I first submitted. In that case,
it's not really an extra backtrack since I have to dec to read the
byte. If I had access to dec_bytepos declared in syntax.c, I think I
could use that to avoid the extra backtrack (I'd fetch the dec_bytepos
(bpos)) and test that and then only move the pointers if not breaking
from the loop.

I left the fetch_char_advance in the TO algorithm since it didn't seem
necessary to replace it with separate fetch/inc_both.

This could be done w/o the backtracking entirely by keeping two
pointers, but that's more complicated, probably not much more
efficient (if at all) and this will likely never be called in a tight
loop.

Let me know how this looks and if you want me to make any tweaks.

Attachment: 0001-Fix-window-text-pixel-size-with-leading-trailing-spa.patch
Description: Binary data


reply via email to

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