aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-05 10:34:33 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-05 10:34:33 +0200
commitff51dc2fb2b66553825c0e5710373eb8db17319c (patch)
treef1c7be1eb7184a5c7bac37c369415e173fcda3b4 /lisp/mastodon-toot.el
parentcf6b3f9f0cb8e9d9a879a18aaf574db835af5223 (diff)
fixes for reply in compose
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 0aadd28..be2d0a3 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -1428,15 +1428,19 @@ LONGEST is the length of the longest binding."
"Format a REPLY-TEXT for display in compose buffer docs."
(let* ((rendered (mastodon-tl--render-text reply-text))
(no-props (substring-no-properties rendered))
- (no-newlines (replace-regexp-in-string "\n\n" "" no-props))
+ ;; FIXME: this regex replaces \n at end of every post
+ ;; so we have to trim:
+ (no-newlines (string-trim
+ (replace-regexp-in-string "[\n]+" " " no-props)))
+ (reply-to (concat " Reply to: \"" no-newlines "\""))
(crop (truncate-string-to-width
;; (string-limit
- (concat " Reply to: \"" no-newlines "\"")
+ reply-to
mastodon-toot-orig-in-reply-length)))
(if (> (length no-newlines)
(length crop)) ; we cropped:
(concat crop "\n")
- no-newlines)))
+ (concat reply-to "\n"))))
(defun mastodon-toot--display-docs-and-status-fields (&optional reply-text)
"Insert propertized text with documentation about `mastodon-toot-mode'.