From b58944592afc9109718f5c0431fb337e68729715 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 6 Jun 2026 12:05:04 -0500 Subject: 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. --- pearl.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pearl.el') diff --git a/pearl.el b/pearl.el index d2941aa..593cf47 100644 --- a/pearl.el +++ b/pearl.el @@ -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")) -- cgit v1.2.3