From aca2d9bb9259184f742eb697444175bc1efae14b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 4 Feb 2006 21:48:50 +0000 Subject: [PATCH] (display-message-or-buffer): Compare the number of characters to the frame width when determining whether a 1-line message string will fit in the echo area. --- lisp/ChangeLog | 8 +++++--- lisp/simple.el | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d91434f318e..8c47effeaac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,10 @@ 2006-02-04 Kevin Rodgers - * simple.el (display-message-or-buffer): Count screen lines - instead of buffer lines when determining whether the message - will fit in the echo area/minibuffer window. + * simple.el (display-message-or-buffer): Compare the number of + characters to the frame width when determining whether a 1-line + message string will fit in the echo area. Count screen lines + instead of buffer lines when determining whether a multi-line + message will fit in the echo area/minibuffer window. 2006-02-04 Eli Zaretskii diff --git a/lisp/simple.el b/lisp/simple.el index 9ca1cf2c9f3..58b0ba2de57 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 -- 2.39.2