From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Carlos Pita Newsgroups: gmane.emacs.bugs Subject: bug#38181: Actual height of mode-line not taken into account Date: Mon, 18 Oct 2021 20:35:48 -0300 Message-ID: References: <87eeyd3ul0.fsf@bernoul.li> <2a0bf8c7-69df-0532-c6d8-5315ee9fee28@gmx.at> <67bcd8c4-2028-46bb-7971-244304bb7c0a@gmx.at> <776a35b7-1920-2987-88ae-6dcab958a8e4@gmx.at> <0dff07fa-b56f-1227-9f17-94e9b9b4c296@gmx.at> <65006f88-1151-34fe-2741-a80d328f96c5@gmx.at> <312e15c3-83d3-99ee-ef73-8fd6013153cc@gmx.at> <7626992f-ab12-5df2-9061-77cb1e276556@gmx.at> <831r4idw8s.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 38181@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 19 01:37:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mccBr-0007gJ-De for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Oct 2021 01:37:11 +0200 Original-Received: from localhost ([::1]:36300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mccBp-0004yV-VQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Oct 2021 19:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mccBi-0004yF-2B for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 19:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mccBh-0008NU-On for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 19:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mccBh-0005p5-J1 for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 19:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Carlos Pita Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Oct 2021 23:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38181 X-GNU-PR-Package: emacs Original-Received: via spool by 38181-submit@debbugs.gnu.org id=B38181.163460016922300 (code B ref 38181); Mon, 18 Oct 2021 23:37:01 +0000 Original-Received: (at 38181) by debbugs.gnu.org; 18 Oct 2021 23:36:09 +0000 Original-Received: from localhost ([127.0.0.1]:48866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mccAq-0005nb-CL for submit@debbugs.gnu.org; Mon, 18 Oct 2021 19:36:08 -0400 Original-Received: from mail-yb1-f174.google.com ([209.85.219.174]:45688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mccAo-0005mx-BM for 38181@debbugs.gnu.org; Mon, 18 Oct 2021 19:36:06 -0400 Original-Received: by mail-yb1-f174.google.com with SMTP id i84so515217ybc.12 for <38181@debbugs.gnu.org>; Mon, 18 Oct 2021 16:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R7oTF8ivKLhWFiArnqbm947e/eRhxp0p7ZTKR+F9l/M=; b=dL8ZgpVxzqaAbMAoivCzcnECZAFDurX/AQNeyLkhbWIO5RsTQNg1I5dMsGdUjjPq7U cAhut2SZSQU9VRgQHrtxpW9FaesDcwhaEGq20c/+oxPQdQ52rOsbG8on+k1WhGriqroD NLJ0rsr5JSKfutFB74xwlrAcKt8axRDf6dNUyhpGujkeRJJwSPbZ0WANeO7EhUD1+7SB Ms5WQpkCdnAYre67g0vE7N8QCGzIPtR29lEV1iuHAARDlBXPHOmWAfsMpOiMHKt3TP1B 3J6CLJwn669zkovg26sfs2vwoKSB/+RVAmnjliIExHXSWKI/WfAlIeSFK75r3k6tzqkB JDMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R7oTF8ivKLhWFiArnqbm947e/eRhxp0p7ZTKR+F9l/M=; b=KREOBu9B0YLT43sqgZ0/lHjqQ41rxKI/vEAYeHZOZ7IpNcnqwk831qVZGSZcwXC1O7 SuJMLDA21FPexqOSfV0de/FfMCBRORFcNVMWw7gXwZEPKemAqR0ylbhVFcnJcVpKgrrl SLI4q2/+OLuoLm/R3enLGgoN5XyayeXbpetU1eHBfM6yJz95dTj9MWAy5DhoFsgBvr33 AYBvXdD1R3BNPTpXbOQ+dRJjmBzqMwzYl61wFUbrwSN8q4L6akkVAWKZ8zvApIhj4Me+ 0BBb1M4KlXicC8feBUOpi8w7dAFVSnkGuuFrW822wYIq+LP7KAH+s1guXZ9RZgrTS5NQ ABEg== X-Gm-Message-State: AOAM532AJByl9+7miVODq1uDFFkcwpBseBm7Z4Fe3GKqRZ/iwTuF5AJE IQ8694UuFuOEdirUnKGuRYVxqivFbUkDed4js54= X-Google-Smtp-Source: ABdhPJxNd8ffnNno31fqwWBM3eHkPg1XYhWuxx1fDGyipIkARAiE3P8Qu95l+Hgbb7Li7NcnKbdJYD/6TDHRVIFErUI= X-Received: by 2002:a25:3104:: with SMTP id x4mr32421747ybx.512.1634600160695; Mon, 18 Oct 2021 16:36:00 -0700 (PDT) In-Reply-To: <831r4idw8s.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217527 Archived-At: (Sorry if it ends up being a dup but I'm resending this because I'd previously sent it with an attached screencast and it seems that it's not being accepted by the bug tracker. In any case, it was the wrong cast :P. Please let me know if there's a policy wrt screencasts, even the right ones. I think it could be useful in this case but it's not that important.) Hi, Here is one more example that tries to capture the essence of another popup dialog in org that is giving me headaches. It's fixed by applying Martin's patch, it's not "fixed" with the redisplay-before-fit workaround (although the redisplay does make a difference as shown below) and it's "fixed" with the redisplay-after-creation workaround. 1) I run emacs -q and execute this simple code that opens a window with 30 numbers, each in its own line: (progn (switch-to-buffer-other-window "popup") (erase-buffer) (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) (fit-window-to-buffer)) The window properly fits the numbers, which are all visible (please ensure your screen and frame is large enough). Now I close the window and make the modeline bigger as in Jonas' example: (setq-default mode-line-format (cons (propertize " " 'display (create-image "/* XPM */ static char * image[] = { \"3 60 1 1\", \"0 c #00aaff\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\", \"000\",\n\"000\",\n\"000\",\n\"000\",\n\"000\" };" 'xpm t :ascent 'center)) mode-line-format)) 2) If I run the code above one more time, that is: (progn (switch-to-buffer-other-window "popup") (erase-buffer) (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) (fit-window-to-buffer)) The numbers are only partially visible, the window looks as if I had scrolled the buffer down to the bottom. Scrolling up it's easy to see that not all of the numbers fit the window. I guess this is expected because of the miscalculations regarding the modeline height. 3) Now I add a redisplay before the fit: (progn (switch-to-buffer-other-window "popup") (erase-buffer) (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) (redisplay t) (fit-window-to-buffer)) Again, only about half of the numbers are visible and the window looks as if its buffer has been scrolled down. But now by scrolling up I can check that all the numbers fit the window. So the height of the window is right but there is that unnecessary scrolling down of the contents. 4) Now I repeat with the forced redisplay even earlier: (progn (switch-to-buffer-other-window "popup") (redisplay t) (erase-buffer) (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) (fit-window-to-buffer)) This seems to work around the issue. I believe that in 3 there is some miscalculation during the insertion of text into the buffer that forces a scroll, but I'm having a hard time trying to explain that. Anyway, it's another case the redisplay-before-fit advice can't cope with. Best regards, Carlos