aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-04 15:47:50 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-04 15:47:50 +0200
commit3e95cd859045591ee31c229694fe8a957bce90ce (patch)
treea46bf2a7ae3cc5950c3e64a78e5e9da5ab33bce8 /lisp/mastodon-toot.el
parentb0406630ccbefe50431f6ea1316857fe9674a2ec (diff)
wrap reply in compose buffer
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 05cd1fb..95b1c5f 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -130,7 +130,8 @@ You need to install company yourself to use this."
"Display a copy of the toot replied to in the compose buffer."
:type 'boolean)
-(defcustom mastodon-toot-orig-in-reply-length 160
+(defcustom mastodon-toot-orig-in-reply-length 191
+ ;; three lines of divider width: (- (* 3 67) (length " Reply to: "))
"Length to crop toot replied to in the compose buffer to."
:type 'integer)
@@ -1422,15 +1423,14 @@ LONGEST is the length of the longest binding."
(defun mastodon-toot--format-reply-in-compose-string (reply-text)
"Format a REPLY-TEXT for display in compose buffer docs."
(let* ((rendered (mastodon-tl--render-text reply-text))
- (no-newlines (replace-regexp-in-string "\n\n" "\n" rendered)))
- (concat " Reply to:\n\""
- ;; (propertize
- (truncate-string-to-width
- no-newlines
- mastodon-toot-orig-in-reply-length)
- ;; overridden by containing propertize call:
- ;; 'face 'mastodon-toot-docs-reply-text-face)
- "...\"\n")))
+ (no-newlines (replace-regexp-in-string "\n\n" "\n" rendered))
+ (crop (string-limit
+ (concat " Reply to: " no-newlines)
+ mastodon-toot-orig-in-reply-length)))
+ (if (> (length no-newlines)
+ (length crop)) ; we cropped:
+ (concat crop "\n")
+ no-newlines)))
(defun mastodon-toot--display-docs-and-status-fields (&optional reply-text)
"Insert propertized text with documentation about `mastodon-toot-mode'.