diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-07-30 15:35:44 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-07-30 15:35:44 +0200 |
commit | 134ec9413a86bc97320548cba3dcfda286ebd938 (patch) | |
tree | 7c6a7e68c14d5f019bbc92159a38afd6c81d86a3 | |
parent | 4844a1147a7ae23c996aa21a98ae4229fe172649 (diff) |
small adjustments to point placement with (un)folding
-rw-r--r-- | lisp/mastodon-tl.el | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b9a5535..ad8cc1a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1597,24 +1597,27 @@ Folding decided by `mastodon-tl--fold-toots-at-length'." ;; `replace-region-contents' is much to slow, our hack from fedi.el is ;; much simpler and much faster (let ((beg (car range)) - (end (cdr range))) + (end (cdr range)) + (last-point (point))) (save-excursion (goto-char beg) (delete-region beg end) (delete-char 1) ;; prevent newlines accumulating (mastodon-tl--toot toot nil nil nil (when (not fold) :unfolded))) - ;; move point to line where text formerly ended: - (unless fold - (goto-char end) - (beginning-of-line))))))) + (cond ((or fold byline) + ;; if folding, or if point was at byline already: + ;; FIXME: ideally we could goto last-point if folding but + ;; point was not in now hidden area) + (mastodon-tl--goto-next-item)) + (t + (goto-char last-point) + (beginning-of-line)))))))) (defun mastodon-tl--fold-post () "Fold post at point, if it is too long." (interactive) - (mastodon-tl--unfold-post :fold) - ;; inserting leaves us at beg of toot, so let's leave point at byline: - (mastodon-tl--goto-next-item)) + (mastodon-tl--unfold-post :fold)) ;; from mastodon-alt.el: (defun mastodon-tl--toot-for-stats (&optional toot) |