Skip to content

Commit

Permalink
truncate multi-line messages less aggressively
Browse files Browse the repository at this point in the history
When preparing multiline messages for the minibuffer, unwrap onto one line
and only truncate as much as necessary.  Previously, we showed the first
line and only a small part of the second.

closes #988
  • Loading branch information
bergey committed Nov 13, 2015
1 parent a5e89ff commit 327df6d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions haskell-interactive-mode.el
Expand Up @@ -412,13 +412,15 @@ SESSION, otherwise operate on the current buffer.

(defun haskell-mode-message-line (str)
"Message only one line, multiple lines just disturbs the programmer."
(let ((lines (split-string str "\n" t)))
(when (and (car lines) (stringp (car lines)))
(message "%s"
(concat (car lines)
(if (and (cdr lines) (stringp (cadr lines)))
(format " [ %s .. ]" (haskell-string-take (haskell-string-trim (cadr lines)) 10))
""))))))
(message (haskell-mode-one-line str (frame-width))))

(defun haskell-mode-one-line (str width)
"Try to fit as much as possible on one line."
(let*
((long-line (replace-regexp-in-string "\n" " " str))
(condensed (replace-regexp-in-string " +" " "
(haskell-string-trim long-line))))
(truncate-string-to-width condensed width nil nil "")))

(defun haskell-interactive-mode-tab ()
"Do completion if at prompt or else try collapse/expand."
Expand Down

0 comments on commit 327df6d

Please sign in to comment.