From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38828@debbugs.gnu.org
Subject: bug#38828: 26.3; Customized mode line breaks height of vertical scroll bar
Date: Wed, 1 Jan 2020 18:49:30 +0100 [thread overview]
Message-ID: <be517183-019f-5554-1b69-f2c00933f380@gmx.at> (raw)
In-Reply-To: <83tv5fjgxn.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2941 bytes --]
> AFAICT, when the ml_row->mode_line_p flag is reset, ml_row->height is
> also zero, so disregarding the flag would not have helped us in this
> case.
Right, I've been there initially.
>> For the record: Rewriting 'window_box_height' as
>>
>> int
>> window_box_height (struct window *w)
>> {
>> return WINDOW_BOX_TEXT_HEIGHT (w);
>> }
>>
>> fixes the problem here.
>
> Thanks, but that's not an idea I would like entertaining.
Neither do I.
> As much as
> window_box_text_height
"window_box_height" presumably, also everywhere below.
> and WINDOW_BOX_TEXT_HEIGHT look similar,
> there's a subtle difference between them. The latter is supposed not
> to be called during redisplay, because window's mode_line_height field
> is not guaranteed to be accurate then,
Your patch does use it though.
> and the fallback is the same
> estimate_mode_line_height which doesn't support non-character display
> elements. It is generally okay to use WINDOW_BOX_TEXT_HEIGHT in
> window.c,
window.c doesn't use it. It's used in xdisp.c only. And I'm sure it
can return negative values, sometimes. So I presume we can do away
with it then?
> because that code runs outside of redisplay, and the window
> object should be up-to-date. But window_box_text_height is called
> _a_lot_ from within redisplay itself. And here we get to another
> subtlety: window_box_text_height uses the window's current_matrix,
> which might not be up-to-date yet, depending on where it is called,
> because we only update it in update_frame, and set_vertical_scroll_bar
> is called long before that.
>
> When a window is resized, as happens in this scenario when the
> echo-area message is cleared, the mode-line row changes to a different
> one (because it is always the last row of the window), and the new row
> didn't yet get updated. We have the correct data in the
> desired_matrix, but not in the current_matrix. I considered using the
> desired_matrix in this case, but that is also somewhat scary: the
> desired matrix could be very sparse under some redisplay
> optimizations, so we'd need some logic to verify the data is valid
> before using it.
I've tried via
w->mode_line_height
= MATRIX_MODE_LINE_ROW (w->current_matrix)->height
= DESIRED_MODE_LINE_HEIGHT (w);
after displaying the mode lines without great success (likely because
window_box_height didn't go for it then).
> Eventually, a simpler solution is just to fall back
> to the window's mode_line_height field, before falling back to
> estimate_mode_line_height, because when the mode-line height changes,
> we schedule an immediate thorough redisplay of the window, and
> invalidate that window's mode_line_height field, to be recomputed by
> the rescheduled redisplay. See the proposed patch below.
This fails here when loading the attached test-popup-2.el and typing,
for example, F2 <up> F3 <up> F2 <up>.
martin
[-- Attachment #2: test-popup-2.el --]
[-- Type: text/plain, Size: 1490 bytes --]
(defvar old-mode-line-format mode-line-format)
(defun foo-message (&optional newline)
(message
(concat (if newline "\n" "")
"total: %s, body: %s, mode: %s")
(window-pixel-height) (window-body-height nil t)
(window-mode-line-height)))
(defun foo ()
(interactive)
(foo-message))
(global-set-key [f1] 'foo)
(defun test-popup ()
(interactive)
;; (set-face-attribute 'mode-line nil :height 200)
;; (set-face-attribute 'mode-line-inactive nil :height 200)
(setq
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))
(foo-message t))
(global-set-key [f2] 'test-popup)
(defun bar ()
(interactive)
(setq mode-line-format old-mode-line-format))
(global-set-key [f3] 'bar)
next prev parent reply other threads:[~2020-01-01 17:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-31 9:57 bug#38828: 26.3; Customized mode line breaks height of vertical scroll bar martin rudalics
2019-12-31 16:05 ` martin rudalics
2020-01-01 16:10 ` Eli Zaretskii
2020-01-01 17:49 ` martin rudalics [this message]
2020-01-02 14:15 ` Eli Zaretskii
2020-01-02 19:19 ` martin rudalics
2020-01-02 19:58 ` Eli Zaretskii
2020-01-03 7:31 ` Eli Zaretskii
2020-01-03 9:38 ` martin rudalics
2020-01-03 10:19 ` Eli Zaretskii
2020-01-03 10:43 ` martin rudalics
2020-01-03 13:07 ` Eli Zaretskii
2020-01-03 15:57 ` martin rudalics
2020-01-03 16:08 ` Eli Zaretskii
2020-01-03 16:34 ` martin rudalics
2020-01-03 17:11 ` Eli Zaretskii
2020-01-03 16:30 ` Eli Zaretskii
2020-01-03 17:16 ` martin rudalics
2020-01-04 19:36 ` Amin Bandali
2020-01-04 19:43 ` Eli Zaretskii
2020-01-04 20:25 ` Amin Bandali
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=be517183-019f-5554-1b69-f2c00933f380@gmx.at \
--to=rudalics@gmx.at \
--cc=38828@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.