all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Carlos Pita <carlosjosepita2@gmail.com>
Cc: 38181@debbugs.gnu.org
Subject: bug#38181: Actual height of mode-line not taken into account
Date: Sat, 16 Oct 2021 18:48:41 +0200	[thread overview]
Message-ID: <f97b064f-a2e8-5e4e-a83c-1fb94b59723f@gmx.at> (raw)
In-Reply-To: <CAEOO5TcfUbM3o+f2D=X4f6eCBUa=DEqEWh_YV_4L5MDu-FoDew@mail.gmail.com>

 > Now, let's define test-popup-no-redisplay as the version of test-popup
 > with the call to redisplay removed, and test-popup-redisplay as the
 > version that calls redisplay before fitting the window to its buffer:
 >
 > (test-popup-no-redisplay) -> cropped content
 > close popup
 > (test-popup-no-redisplay) -> cropped content
 > close popup
 > (test-popup-redisplay) -> ok
 > close popup
 > (test-popup-redisplay) -> ok
 > close popup
 > (test-popup-no-redisplay) -> cropped content
 > close popup
 >
 > As you can see, the redisplay only "fixes" the next fit, after that the
 > problem reappears.

Right.  The "close popup" removes anything redisplay cached for the
window's mode line in the last call of 'test-popup-redisplay'.

 > This may be of interest:
 >
 > (test-popup-no-redisplay) -> cropped content
 > (test-popup-no-redisplay) -> ok
 > (test-popup-no-redisplay) -> ok
 > (test-popup-no-redisplay) -> ok
 >
 > (N.B. I'm not closing the popup) It seems like the window was reused
 > and the second time it got things right.

Right.  It always uses the cached mode line height in this case.

 > My interpretation is that the early redisplay "prepares" the current
 > window for the fit. Now, the workaround that I linked above does a
 > redisplay once per buffer, not once per window.

What is the "workaround"?  IIUC there is no "redisplay" one can call on
a "per buffer" base.

 > The issue I observe,
 > which I believe is the same one that motivated this report in the
 > first place, is an org-set-tags-command menu clipped at the bottom
 > (it's not the only case, though). Since the popup windows that
 > org-mode opens for this and other menus are transient but their
 > buffers likely remain hidden, that may be the reason why the
 > workaround is not, well, working around. What I'm failing to grasp is
 > how could it ever work... maybe there was some change in the
 > implementation of org-mode popups.
 >
 > I would be happy with a sound statement like "if you change the
 > modeline height so it is different to the default char size, you need
 > to call redisplay for each window that sports the modified modeline
 > before executing any operation that requires knowledge of the geometry
 > of that modeline, including fit-window-to-buffer". If that's true then the
 > current trick could be reasonably modified to cope with every possible
 > case instead of hooking to particular functions (fit-window-to-buffer) in
 > maybe the wrong scope (buffer), by just triggering an early redisplay
 > each time a new window is created.

Even the 'redisplay' trick will not be sufficient: Consider Eli's
scenario in this thread but with _different_ heights for active and
inactive mode lines.  It will break things when after doing the
'fit-window-to-buffer' call you (de-)select the window you've just fit.

 > Rereading (some of) the above thread, I noticed you said:
 >
 >> If we don't want 'fit-window-to-buffer' to do that always we'd need
 >> some variable, either buffer local or even a window parameter, that
 >> 'fit-window-to-buffer' would inspect once and reset immediately in
 >> order to perform only the redisplay call that's really needed.
 >
 > I believe this is similar to what I've just suggested. Then a long
 > discussion full of technicalities that I won't be able to follow in
 > depth anytime soon took place. I understand that maybe forcing an
 > early display is not ideal because, in principle, we only want to
 > update the size of the modeline, not prematurely redisplay the window.
 > Moreover, modelines could change after creating a window,
 > but this is not an interesting use case in real life.
 > But since creating a window is not a frequent operation, and
 > changing a modeline on the fly is not a likely event, would it be
 > so bad to trigger that early redisplay on window creation?

I think you mean with every set_window_buffer?  And probably with every
set_window_configuration too.  Did you try it?

 > I'm not saying that emacs should do it, I'm confident that your
 > decision in this regard will be far better than anything I could
 > come up with, I'm just looking for a workaround that gets the job
 > done or, alternatively, the certainty that it's a bad idea and that we
 > should refrain from pretiffing modelines.

Here I have no problems with the scenarios I've seen in this thread
because I update the mode line caches with every change of a window
height (which includes the case where a window is created) and with any
change of a buffer local variable like 'mode-line-format'.  So basically
no redisplay is ever needed in the first place, just a recalculation of
the mode line heights of all windows whose heights have changed.

martin





  reply	other threads:[~2021-10-16 16:48 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 16:52 bug#38181: Actual height of mode-line not taken into account Jonas Bernoulli
2019-11-13  8:03 ` martin rudalics
2019-11-15 13:50   ` Eli Zaretskii
2019-11-15 13:48 ` Eli Zaretskii
2019-11-15 14:24   ` Jonas Bernoulli
2019-11-15 15:11     ` Eli Zaretskii
2019-11-15 23:51       ` Jonas Bernoulli
2019-11-16  8:38         ` Eli Zaretskii
2019-11-16 14:54           ` Jonas Bernoulli
2019-11-16 15:59             ` Eli Zaretskii
2019-11-17 16:17               ` Jonas Bernoulli
2019-11-15 19:38   ` Eli Zaretskii
2019-11-16  8:20     ` martin rudalics
2019-11-16  8:35       ` Eli Zaretskii
2019-11-16  8:57         ` martin rudalics
2019-11-16 10:57           ` Eli Zaretskii
2019-11-16 19:28             ` martin rudalics
2019-11-16 19:44               ` Eli Zaretskii
2019-11-17  8:55                 ` martin rudalics
2019-11-17 17:26                   ` Eli Zaretskii
2019-11-17 18:15                     ` martin rudalics
2019-11-17 18:35                       ` Eli Zaretskii
2019-11-18  9:44                         ` martin rudalics
2019-11-18 15:42                           ` Eli Zaretskii
2019-11-18 18:45                             ` martin rudalics
2020-05-02 18:06                     ` martin rudalics
2020-05-04 13:46                       ` Eli Zaretskii
2020-05-04 15:04                         ` martin rudalics
2020-05-04 17:05                           ` martin rudalics
2020-05-05  8:32                             ` martin rudalics
2020-05-05 14:58                               ` Eli Zaretskii
2020-05-05 16:57                                 ` martin rudalics
2020-05-05 17:11                                   ` Eli Zaretskii
2020-05-06  6:50                                     ` martin rudalics
2020-05-06  9:27                                       ` Eli Zaretskii
2020-05-06  9:44                                         ` martin rudalics
2020-05-06 14:16                                         ` Eli Zaretskii
2020-05-07  8:34                                           ` martin rudalics
2020-05-07 12:41                                             ` Eli Zaretskii
2020-05-06 14:44                                   ` Eli Zaretskii
2020-05-07  8:34                                     ` martin rudalics
2020-05-10 14:33                                       ` Eli Zaretskii
2020-05-11  8:30                                         ` martin rudalics
2020-05-15 15:00                                           ` Eli Zaretskii
2020-05-16  8:44                                             ` martin rudalics
2020-05-16 10:46                                               ` Eli Zaretskii
2019-11-16 15:27           ` Jonas Bernoulli
2019-11-16 16:19             ` Eli Zaretskii
2019-11-16 19:30               ` martin rudalics
2019-11-16 19:45                 ` Eli Zaretskii
2019-11-17  9:01                   ` martin rudalics
2019-11-17 17:22                     ` Eli Zaretskii
2019-11-17 18:16                       ` martin rudalics
2019-11-17 18:39                         ` Eli Zaretskii
2019-11-18  9:45                           ` martin rudalics
2019-11-18 15:46                             ` Eli Zaretskii
2019-11-18 18:46                               ` martin rudalics
2019-11-17 16:21               ` Jonas Bernoulli
2019-11-16 19:30             ` martin rudalics
2021-10-15  5:13 ` Carlos Pita
2021-10-15  7:05   ` martin rudalics
2021-10-15  7:26     ` Carlos Pita
2021-10-15  7:54       ` Eli Zaretskii
2021-10-15  8:18         ` Carlos Pita
2021-10-15  8:35       ` martin rudalics
2021-10-15  8:45         ` Carlos Pita
     [not found]         ` <CAEOO5TdaV=tdj23afEcqJGZf4JM3VVQ6TFt4F3q6k6d=f4_36w@mail.gmail.com>
     [not found]           ` <776a35b7-1920-2987-88ae-6dcab958a8e4@gmx.at>
2021-10-15  9:07             ` Carlos Pita
2021-10-16  7:55               ` martin rudalics
2021-10-16 11:23                 ` Carlos Pita
2021-10-16 16:48                   ` martin rudalics [this message]
2021-10-16 18:00                     ` Carlos Pita
2021-10-16 19:41                       ` martin rudalics
2021-10-16 19:57                         ` Carlos Pita
2021-10-16 21:27                           ` Carlos Pita
2021-10-17  6:06                             ` Eli Zaretskii
2021-10-17  6:45                               ` Carlos Pita
2021-10-17  8:34                               ` martin rudalics
2021-10-17  8:34                             ` martin rudalics
2021-10-17  8:33                           ` martin rudalics
2021-10-18  9:34                             ` martin rudalics
2021-10-18 15:56                               ` Carlos Pita
2021-10-18 17:44                                 ` martin rudalics
2021-10-18 18:27                                   ` Eli Zaretskii
2021-10-18 23:35                                     ` Carlos Pita
2021-10-19  0:11                                       ` Carlos Pita
2021-10-19  9:25                                     ` martin rudalics
2021-10-19 12:22                                       ` Eli Zaretskii
2021-10-22  9:04                                       ` martin rudalics
2021-10-22 14:55                                         ` Carlos Pita
2021-11-07 18:48                                           ` Carlos Pita
     [not found]                                     ` <CAEOO5TemeSrLkudEBRbMaLrCXq7A0y5uv+SdcfZwMo77onMMoA@mail.gmail.com>
2021-10-19 10:09                                       ` martin rudalics
2021-10-15  7:51   ` Eli Zaretskii
2021-10-15  8:00     ` Carlos Pita
2021-10-15 10:40       ` Eli Zaretskii
2021-10-15 18:33         ` Carlos Pita
2021-10-15 19:08           ` Eli Zaretskii
2021-10-15 20:09             ` Carlos Pita

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

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

  git send-email \
    --in-reply-to=f97b064f-a2e8-5e4e-a83c-1fb94b59723f@gmx.at \
    --to=rudalics@gmx.at \
    --cc=38181@debbugs.gnu.org \
    --cc=carlosjosepita2@gmail.com \
    /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 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.