* window-text-pixel-size and presumable move_it_to change(s)
@ 2016-06-23 8:18 martin rudalics
2016-06-23 14:51 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: martin rudalics @ 2016-06-23 8:18 UTC (permalink / raw)
To: emacs-devel
‘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). 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? If so, what
can I do to get the old behavior back?
Thanks, martin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: window-text-pixel-size and presumable move_it_to change(s)
2016-06-23 8:18 window-text-pixel-size and presumable move_it_to change(s) martin rudalics
@ 2016-06-23 14:51 ` Eli Zaretskii
2016-06-24 8:09 ` martin rudalics
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-06-23 14:51 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
> Date: Thu, 23 Jun 2016 10:18:20 +0200
> From: martin rudalics <rudalics@gmx.at>
>
> ‘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.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: window-text-pixel-size and presumable move_it_to change(s)
2016-06-23 14:51 ` Eli Zaretskii
@ 2016-06-24 8:09 ` martin rudalics
0 siblings, 0 replies; 3+ messages in thread
From: martin rudalics @ 2016-06-24 8:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
> 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.
That was the cause. Thanks for the solution.
> (In general, I suggest to make a rule to never use 'min' or 'max' when
> their arguments are expressions.)
Indeed, I have to be more careful in this regard.
Many thanks, martin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-24 8:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-23 8:18 window-text-pixel-size and presumable move_it_to change(s) martin rudalics
2016-06-23 14:51 ` Eli Zaretskii
2016-06-24 8:09 ` martin rudalics
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.