aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-question-print.el6
-rw-r--r--sx.el4
2 files changed, 7 insertions, 3 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index f9ecfab..778b580 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -286,10 +286,10 @@ The comment is indented, filled, and then printed according to
(format sx-question-mode-comments-format
(sx-user--format "%d" .owner)
(substring
- ;; We fill with three spaces at the start, so the comment is
- ;; slightly indented.
(sx-question-mode--fill-and-fontify
- (concat " " .body_markdown))
+ ;; We fill with three spaces at the start, so the comment is
+ ;; slightly indented.
+ (concat " " (sx--squash-whitespace .body_markdown)))
;; Then we remove the spaces from the first line, since we'll
;; add the username there anyway.
3))))))
diff --git a/sx.el b/sx.el
index 26151b3..14af94d 100644
--- a/sx.el
+++ b/sx.el
@@ -331,6 +331,10 @@ GET-FUNC and performs the actual comparison."
(funcall ,get-func a)
(funcall ,get-func b))))
+(defun sx--squash-whitespace (string)
+ "Return STRING with consecutive whitespace squashed together."
+ (replace-regexp-in-string "[ \r\n]+" " " string))
+
;;; Printing request data
(defvar sx--overlays nil