From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: window-text-pixel-size and presumable move_it_to change(s) Date: Thu, 23 Jun 2016 17:51:53 +0300 Message-ID: <83twgk2c1i.fsf@gnu.org> References: <576B9B4C.5080503@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1466693577 32304 80.91.229.3 (23 Jun 2016 14:52:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jun 2016 14:52:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 23 16:52:55 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bG5zy-0003yy-M4 for ged-emacs-devel@m.gmane.org; Thu, 23 Jun 2016 16:52:54 +0200 Original-Received: from localhost ([::1]:37135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG5zx-0002FD-TY for ged-emacs-devel@m.gmane.org; Thu, 23 Jun 2016 10:52:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG5zp-0002DX-Ti for emacs-devel@gnu.org; Thu, 23 Jun 2016 10:52:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG5zl-0006Op-MG for emacs-devel@gnu.org; Thu, 23 Jun 2016 10:52:44 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG5zl-0006OW-JC; Thu, 23 Jun 2016 10:52:41 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2923 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bG5zj-0001lU-MH; Thu, 23 Jun 2016 10:52:40 -0400 In-reply-to: <576B9B4C.5080503@gmx.at> (message from martin rudalics on Thu, 23 Jun 2016 10:18:20 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204690 Archived-At: > Date: Thu, 23 Jun 2016 10:18:20 +0200 > From: martin rudalics > > ‘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.)