unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: window-text-pixel-size and presumable move_it_to change(s)
Date: Thu, 23 Jun 2016 17:51:53 +0300	[thread overview]
Message-ID: <83twgk2c1i.fsf@gnu.org> (raw)
In-Reply-To: <576B9B4C.5080503@gmx.at> (message from martin rudalics on Thu, 23 Jun 2016 10:18:20 +0200)

> 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.)



  reply	other threads:[~2016-06-23 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-06-24  8:09   ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83twgk2c1i.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).