[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: window-text-pixel-size and presumable move_it_to change(s)
From: |
Eli Zaretskii |
Subject: |
Re: window-text-pixel-size and presumable move_it_to change(s) |
Date: |
Thu, 23 Jun 2016 17:51:53 +0300 |
> Date: Thu, 23 Jun 2016 10:18:20 +0200
> From: martin rudalics <address@hidden>
>
> ‘fit-window-to-buffer’ is currently broken on master when the window is
> horizontally combined. I traced it back to the following differnece:
> Consider these two forms:
>
> (window-text-pixel-size nil (window-start) (point-max) (frame-pixel-width)
> (window-body-height nil t))
>
> (window-text-pixel-size nil (window-start) (point-max) nil
> (window-body-height nil t))
>
> With emacs -Q on the release branch evaluating both forms via M-: gets
> me (576 . 48).
>
> With emacs -Q on master evaluating the first form gets me (0 . 48) while
> evaluating the second form gets me (576 . 48).
Yes, I see something like that as well.
> I conclude that the behavior of move_it_to has changed recently when
> setting
>
> it.last_visible_x = max_x;
>
> in Fwindow_text_pixel_size. Is that conclusion correct?
No, the above still works as before. The problem is in the new code
in Fwindow_text_pixel_size:
x = min (move_it_to (&it, end, INT_MAX, max_y, -1,
MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y),
max_x);
This will call move_it_to twice, and the second call will return a
different value from the correct one, returned by the first call.
Replace this by something less fancy, like
x = move_it_to (&it, end, INT_MAX, max_y, -1,
MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
if (x > max_x)
x = max_x;
and Bob'll be your uncle.
(In general, I suggest to make a rule to never use 'min' or 'max' when
their arguments are expressions.)