Persist the tree view zoom level across Notepad++ sessions - #2
Draft
leoshone wants to merge 2 commits into
Draft
Conversation
The plugin already ships a zoom slider for the JSON tree (80%..250%), but the chosen level only lived in the slider control: closing Notepad++ and starting it again always fell back to 100%. Store the zoom percentage in JSONViewer.ini under [Others] TREE_ZOOM and re-apply it when the dialog is initialised. The value is written only when it actually changes, and while the slider thumb is being dragged (TB_THUMBTRACK) nothing is written, so a drag gesture produces a single write at the end instead of one per pixel. Purely additive: the existing ini keys and the default behaviour are untouched.
leoshone
force-pushed
the
fix/persist-tree-zoom
branch
from
September 3, 2026 10:18
31fd4f1 to
05c1128
Compare
WM_HSCROLL carries the notification code in LOWORD(wParam), not HIWORD: HIWORD holds the thumb position itself (80..250 here), so comparing it against TB_THUMBTRACK never matched and the zoom was written to the ini file continuously while the thumb was being dragged, instead of once when the gesture ended. Found by an independent review of the integration branch; the end-to-end harness never caught it because it only sends TB_ENDTRACK and never simulates the dragging itself.
leoshone
force-pushed
the
fix/persist-tree-zoom
branch
from
September 5, 2026 04:15
16bad52 to
7771ca0
Compare
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.
Problem
The JSON tree already has a zoom slider (80%..250%, plus Ctrl+MouseWheel over
the panel), but the chosen level is not remembered: after restarting Notepad++
the tree is always back at 100%.
Steps to reproduce
say 150%, until the slider is touched again.
Cause
Settinghad no field for the zoom level, soProfileSetting::GetSettings()and
SetSettings()had nothing to read or write. The level only ever lived inthe trackbar control.
Fix
Setting::nTreeZoom(default 100) plus a new[Others] TREE_ZOOMkey inJSONViewer.ini, read and written exactly like the neighbouring keys.
JsonViewDlg::PersistZoom()writes the value when it changes.WM_INITDIALOGre-applies the level that was read from the ini.TB_THUMBTRACK) nothing is written,so one gesture produces one write instead of one per pixel.
Notes
changed, no resource or UI change.
TREE_ZOOMkey and falls back to100%.
Tests
tests/UnitTest/ProfileTest.cppTreeZoom_RoundTrip- default is 100%, and 80/100/150/200/250 survive awrite/read cycle.
SetSettings_Positive- extended to cover the new field.