unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: n142857@gmail.com, 73022@debbugs.gnu.org
Subject: bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size
Date: Thu, 12 Sep 2024 11:49:36 +0200	[thread overview]
Message-ID: <718661cf-90f1-4590-b635-778dc3a5a099@gmx.at> (raw)
In-Reply-To: <86wmjinsao.fsf@gnu.org>

 >> It _might_ be incorrect when we allow FRAME_TOTAL_LINES (f) to exceed
 >> FrameRows (FRAME_TTY (f)) because we refuse to shrink a frame below some
 >> height.  That's why I used the term "probably".  If I knew what that
 >> code does in all consequences, I could tell you more.  But I don't know.
 >
 > If FRAME_TOTAL_LINES is different from FrameRows at that spot, it's a
 > bug, isn't it?

It depends.  On a GUI frame do the following: In *scratch* insert the
two lines

(insert (format "%s" (frame-native-height)))
(insert (format "%s" (window-pixel-height (frame-root-window))))

and then do C-x 2 three times so yet get four windows.  Now with the
mouse drag the lower border upwards as far as you can.  The minibuffer
window should have disappeared by now.  Evaluate the two lines above by
putting point at their end and typing C-x e.  You will see that the
second value exceeds the first one - the root window got larger than
its frame.  So the window dimensions as Emacs can reasonably draw them
exceed the dimensions of the window as the WM gives them to us.

The same thing happens on TTY frames.  With split windows, the size of
the root window may exceed the size of the terminal window.  Whether we
now synch FRAME_TOTAL_LINES and FrameRows is just a matter of taste.

 > I still don't understand what is supposed to happen when we shrink the
 > frame to less lines/columns than the minimum window dimensions we
 > allow.

There are two minimum window dimensions we "allow": The first are the
hard-coded 5/2 values in handle_window_change_signal and additionally
imposed in frame_windows_min_size.  IIUC neither of these takes care of
menu or tab bars nor of any window splitting.  The second is the
'frame-windows-min-size' code that takes care of the entire frame layout
in an equal fashion for GUI frames and TTY frames.  In either case we do
not shrink the dimensions of our windows but keep them as in the GUI
example above.

 > Also, I'd be happier if you could describe the sequence of
 > events that lead to frame and window resizing following a SIGWINCH.

IIUC we call change_frame_size, possibly delay it, and eventually call
adjust_frame_size just as we do for GUI frames.  There's no special
magic involved.

The problematic thing I see is that the entire cursor wrapping code
including the check in cmcheckmagic seem botched because when a window
is virtually drawn below the border of the terminal window (as in the
GUI example sketched above) we do not check whether the cursor ends up
below that border too.  In particular the form

   /* First the degenerate case */
     if (row == curY (tty) && col == curX (tty)) /* already there */
     return;

in cmgoto seems to indicate that we leave the cursor at its current
location.  Maybe we do that even earlier, for example, in

   if (curY (tty) == vpos
       && curX (tty) == hpos)
     return;

of tty_cursor_to.  And maybe neither of these is relevant because
redisplay simply does nothing if the size of the root window does not
change (I wouldn't know where and how redisplay checks that).  At the
very end the check in cmcheckmagic aborts us in any such case.

martin





  reply	other threads:[~2024-09-12  9:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  6:09 bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size Daniel Clemente
     [not found] ` <handler.73022.B.172543028723315.ack@debbugs.gnu.org>
2024-09-04  6:25   ` bug#73022: Acknowledgement (31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size) Daniel Clemente
2024-09-04  7:28 ` bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 12:21   ` Eli Zaretskii
2024-09-04 13:23     ` Eli Zaretskii
2024-09-05  8:18       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05  9:19         ` Eli Zaretskii
2024-09-05 14:46           ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 14:58             ` Eli Zaretskii
2024-09-05 15:48               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:05                 ` Eli Zaretskii
2024-09-05 16:30                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:58                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 18:41                       ` Eli Zaretskii
2024-09-05 18:15                     ` Eli Zaretskii
2024-09-08 11:07         ` Daniel Clemente
2024-09-08 14:36           ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05  8:18     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05  9:18       ` Eli Zaretskii
2024-09-05 14:45         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 15:10           ` Eli Zaretskii
2024-09-05 16:27             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:08             ` Daniel Clemente
2024-09-08 11:31               ` Eli Zaretskii
2024-09-08 14:58               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 17:43                 ` Daniel Clemente
2024-09-11  8:07                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 12:22                     ` Eli Zaretskii
2024-09-11 14:37                       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:06                         ` Eli Zaretskii
2024-09-12  9:49                           ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-08 11:09       ` Daniel Clemente
2024-09-08 14:43         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:32           ` Eli Zaretskii
2024-09-08 17:01             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=718661cf-90f1-4590-b635-778dc3a5a099@gmx.at \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73022@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=n142857@gmail.com \
    --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).