diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-06 12:05:04 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-06 12:05:04 -0500 |
| commit | b58944592afc9109718f5c0431fb337e68729715 (patch) | |
| tree | 5836ab60d24e7e029b6b12112ea4fbea4c9b333e /pearl.el | |
| parent | adee44df124e8983084737c50e9c767edd70aea8 (diff) | |
| download | pearl-b58944592afc9109718f5c0431fb337e68729715.tar.gz pearl-b58944592afc9109718f5c0431fb337e68729715.zip | |
fix(views): re-fold the page after an interactive sort
Setting a sort order opened every issue, drawer, and comment in the buffer. The reorder moves subtrees by deleting the issue block and re-inserting it, and freshly inserted Org text comes in fully expanded. The fold state lives in overlays that delete-and-insert drops. Neither sort path re-folded afterward, unlike the full-render and merge paths, which already do.
Both sort paths now call pearl--restore-page-visibility after a successful reorder, re-folding the page to its #+STARTUP visibility so it stays the scannable outline it was before the sort. A refusal (a grouped buffer or a failed refetch) moves nothing, so it doesn't re-fold. The behavior honors pearl-fold-after-update like the other repopulating paths.
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -6973,6 +6973,10 @@ buffer doesn't show." (let ((ranks (pearl--issue-id-ranks result source))) (pearl--merge-query-result result source) (pearl--reorder-issue-subtrees nil 'asc ranks)) + ;; The reorder rewrites the issue block with delete+insert, which + ;; drops the fold overlays and leaves every subtree expanded. + ;; Re-fold so the page stays the scannable outline it was. + (pearl--restore-page-visibility) (pearl--write-linear-source-header source) (message "Refetched %s ordered by %s %sending" (pearl--source-name source) sort @@ -7002,6 +7006,10 @@ Returns `client', `server', `grouped', or `no-issues'." (message "No issues to sort in this buffer") 'no-issues) (_ + ;; The reorder rewrites the issue block with delete+insert, which + ;; drops the fold overlays and leaves every subtree expanded. Re-fold + ;; so the page stays the scannable outline it was before the sort. + (pearl--restore-page-visibility) (pearl--write-linear-source-header updated) (message "Sorted current buffer by %s %sending" sort (if (eq order 'asc) "asc" "desc")) |
