summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 67225f07f94..ab4700281b6 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1901,11 +1901,14 @@ the contents are inserted into the buffer anyway.
Optional arguments NOT-THIS-WINDOW and FRAME are as for `display-buffer',
and only used if a buffer is displayed."
- (cond ((and (stringp message) (not (string-match "\n" message)))
+ (cond ((and (stringp message)
+ (not (string-match "\n" message))
+ (<= (length message) (frame-width)))
;; Trivial case where we can use the echo area
(message "%s" message))
((and (stringp message)
- (= (string-match "\n" message) (1- (length message))))
+ (= (string-match "\n" message) (1- (length message)))
+ (<= (1- (length message)) (frame-width)))
;; Trivial case where we can just remove single trailing newline
(message "%s" (substring message 0 (1- (length message)))))
(t
@@ -1922,7 +1925,7 @@ and only used if a buffer is displayed."
(let ((lines
(if (= (buffer-size) 0)
0
- (count-lines (point-min) (point-max)))))
+ (count-screen-lines nil nil nil (minibuffer-window)))))
(cond ((= lines 0))
((and (or (<= lines 1)
(<= lines