Persist tree zoom, per-tab tree cache, keep expansion on refresh - #1
Draft
leoshone wants to merge 2 commits into
Draft
Persist tree zoom, per-tab tree cache, keep expansion on refresh#1leoshone wants to merge 2 commits into
leoshone wants to merge 2 commits into
Conversation
R1 Tree zoom (80%-250%) is now written to JSONViewer.ini ([Others]
TREE_ZOOM) and re-applied on start-up. The percentage is stored, not a
device-dependent font size, so it survives DPI changes.
R2 The tree is no longer parsed automatically. Opening the panel or
switching tabs never touches the document; only "Refresh JSON Tree"
does. Each buffer keeps an in-memory snapshot (node contents,
expansion state, selected node) that is restored verbatim when the tab
comes back. Tabs that were never refreshed show the empty placeholder
root. Snapshots are dropped when a tab is closed.
R3 Refresh rebuilds the tree but restores the expansion state and the
selected node by matching node paths; paths that no longer exist are
discarded.
Also removes the now unused "Follow current tab" setting and its
NPPN_READY auto-refresh workaround, and moves auto-format to
NPPN_FILEOPENED so that merely switching tabs never rewrites a document.
Verified locally: gtest 161/161, and 19/19 end-to-end assertions driven
inside a real Notepad++ instance via Window messages.
GitHub Actions was enabled on the fork after the branch and PR were created, so the original pull_request event was never delivered. An empty commit emits a synchronize event to start the build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three usability fixes for the JSON tree panel.
R1 — Tree zoom is persisted
The sidebar zoom (80%–250%, slider / Ctrl+wheel / double-click reset) now writes
[Others] TREE_ZOOMtoJSONViewer.iniand is re-applied on start-up. Thepercentage is stored rather than a concrete font size, so the setting survives
DPI changes. Zoom stays a panel-global property, not per tab.
R2 — Nothing is parsed automatically; tree state is cached per tab
Previously the panel either re-parsed on every tab switch (with "Follow current
tab" on) or went stale (with it off). Now:
the selected node — so switching away and back restores the tree exactly as it
was left, without re-parsing or redrawing.
JSON).R3 — Refresh keeps the expansion state
Refresh rebuilds the tree and then restores the expansion/collapse state and the
selected node by matching node paths; paths that no longer exist are discarded.
Clean-ups
NPPN_READYauto-refresh workaround it needed).NPPN_FILEOPENED, so merely switching tabs no longerrewrites a document. When it fires it formats the document only — the tree is
still left alone until the user refreshes.
Testing
TreeStateTestis new,ProfileTestextended).no-auto-parse, per-tab snapshot isolation (including two levels of expansion),
refresh preserving expansion + selection, snapshot dropped on tab close, and
the zoom round-trip through
JSONViewer.iniand a restart.Note: this branch is on my fork for CI artifacts. Happy to rework anything
before it goes upstream.