unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38966@debbugs.gnu.org
Subject: bug#38966: 27.0.60; Assertion failure in set_cursor_from_row
Date: Mon, 6 Jan 2020 20:06:21 +0100	[thread overview]
Message-ID: <12ea3c04-249a-96da-8c88-52dcb5ca8b66@gmx.at> (raw)
In-Reply-To: <83lfqkecc6.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]

 > I don't expect to have a window that has no lines showing text.  I
 > believe we don't allow creation/resizing of windows to such a small
 > size?  If that's not guaranteed, I'm okay with adding an assertion
 > somewhere, but that would be a separate problem: we never expected
 > such a calamity even before tab-lines were added.

We did.  Try with emacs 26 loading my old test-popup-2.el (attached
once more).  Type C-x 2 and make the lower window as low as you can.
Now hit F2.  The lower window shows no text.

So we did allow windows showing no text before and I see no reason why
we should call that a calamity.  Rather, we should eliminate all
assertions that forbid zero size windows and simply not draw a cursor
when a window's body shrinks to zero pixels.  All applications I know
of tolerate such zero size "windows".

I plan a slight modification that would allow the minibuffer window to
shrink to zero lines whenever it's not used.  OTOH, zero size "normal"
windows would allow to show the minibuffer window in a frame that can
acommodate only one or two lines.

 > If we don't call set_cursor_from_row, we will not have a cursor
 > displayed where it should be, which is a display bug in and of itself.

Isn't that statement overly conservative?  Sooner or later, Emacs will
at least have to allow a mode where the region is not destroyed when a
window is scrolled, allowing the cursor to disappear from the visible
part of its buffer.

We should keep Emacs distinctive.  But being distinctive doesn't
necessarily mean to be restrictive.

 >> BTW: I would also recommend to rename mode_line_p to something like
 >> say "no_text_line_p".  Presently, people like me not used to hack the
 >> display code, might consider mode_line_p verbatim and not apply its
 >> semantics to header or tab lines.
 >
 > Sorry, but that ship sailed a long time ago.  You will have to make do
 > with the comments in dispextern.h, which document this weirdness.

Which comment?  In either case, rest assured that ordinary people will
have considerable troubles understanding code like the proposed

	  if (row->tab_line_p)
	    ++row;
	  if (row->mode_line_p)
	    ++row;

Notwithstanding my concerns, the patch fixes the bug here.

Many thanks, martin

[-- Attachment #2: test-popup-2.el --]
[-- Type: text/plain, Size: 1705 bytes --]

(set-frame-position nil 0 0)
(switch-to-buffer (find-file-noselect "c:/temp/test-popup.el"))
(setq window-resize-pixelwise t)
(setq window-min-height 0)
(set-window-scroll-bars (minibuffer-window) 0 nil 0 nil)
(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)

  reply	other threads:[~2020-01-06 19:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  9:19 bug#38966: 27.0.60; Assertion failure in set_cursor_from_row martin rudalics
2020-01-06 17:14 ` Eli Zaretskii
2020-01-06 19:06   ` martin rudalics [this message]
2020-01-06 19:50     ` Eli Zaretskii
2020-01-07  9:52       ` martin rudalics
2020-01-07 16:01         ` Eli Zaretskii
2020-01-07 17:38           ` martin rudalics
2020-01-07 17:48             ` Eli Zaretskii
2020-01-07 18:23               ` martin rudalics
2020-01-07 18:36                 ` Eli Zaretskii
2020-01-07 18:58                   ` martin rudalics
2020-01-07 19:06                     ` Eli Zaretskii

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=12ea3c04-249a-96da-8c88-52dcb5ca8b66@gmx.at \
    --to=rudalics@gmx.at \
    --cc=38966@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 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).