[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: core dump when window is too short; infinite loop when too narrow
From: |
Algorithm Petrofsky |
Subject: |
Re: core dump when window is too short; infinite loop when too narrow |
Date: |
Sat, 19 Jan 2002 18:38:03 -0800 |
> From: Richard Stallman <address@hidden>
>
> Perhaps the minimum window height needs to be changed from two to
> three, to ensure there is at least one body line.
>
> Instead of that, I arranged for the header line and mode line to
> disappear if the window is not tall enough for them. Thanks.
Cool. I think a couple more changes are required:
--- window.el.~1.81.~ Thu Jan 17 21:42:23 2002
+++ window.el Sat Jan 19 18:27:33 2002
@@ -33,10 +33,12 @@
"Return number of lines in window WINDOW for actual buffer text.
This does not include the mode line (if any) or the header line (if any)."
(or window (setq window (selected-window)))
- (with-current-buffer (window-buffer window)
- (- (window-height window)
- (if mode-line-format 1 0)
- (if header-line-format 1 0))))
+ (if (window-minibuffer-p window)
+ (window-height window)
+ (with-current-buffer (window-buffer window)
+ (max 1 (- (window-height window)
+ (if mode-line-format 1 0)
+ (if header-line-format 1 0))))))
(defun one-window-p (&optional nomini all-frames)
"Return non-nil if the selected window is the only window (in its frame).
--- window.c.~1.398.~ Thu Jan 17 19:50:15 2002
+++ window.c Sat Jan 19 18:07:24 2002
@@ -2118,7 +2118,8 @@
might crash Emacs. */
#define MIN_SAFE_WINDOW_WIDTH (2)
-#define MIN_SAFE_WINDOW_HEIGHT (2)
+#define MIN_SAFE_WINDOW_HEIGHT (1)
+#define MIN_SAFE_MINIWINDOW_HEIGHT (1)
/* Make sure that window_min_height and window_min_width are
not too small; if they are, set them to safe minima. */
@@ -2146,9 +2147,9 @@
whether it wants a mode line, and
whether it has a menu bar. */
int min_height =
- (FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_WINDOW_HEIGHT - 1
+ (FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_MINIWINDOW_HEIGHT
: (! FRAME_HAS_MINIBUF_P (frame)) ? MIN_SAFE_WINDOW_HEIGHT
- : 2 * MIN_SAFE_WINDOW_HEIGHT - 1);
+ : MIN_SAFE_WINDOW_HEIGHT + MIN_SAFE_MINIWINDOW_HEIGHT);
if (FRAME_TOP_MARGIN (frame) > 0)
min_height += FRAME_TOP_MARGIN (frame);