Skip to content

V1.0.0 implementation#2

Merged
JamesShaver merged 8 commits into
mainfrom
v1.0.0-implementation
May 20, 2026
Merged

V1.0.0 implementation#2
JamesShaver merged 8 commits into
mainfrom
v1.0.0-implementation

Conversation

@JamesShaver
Copy link
Copy Markdown
Owner

No description provided.

Reorganizes the repo to follow the standard .NET layout where shipping
code lives under the project name and tests live under tests/. The
solution file, project reference, and CI workflow path are updated to
match. The README's Architecture section now explicitly explains the
purpose of the test project; CONTRIBUTING.md gives a full project-
structure walkthrough for new contributors plus what's covered by
automated tests vs. manual smoke tests.
Both items are file-only and disabled for unsaved buffers (non-rooted paths).
Process.Start is wrapped in using() so the returned Process handle does not
leak per invocation.
The panel was previously lazy-created on first menu click, by which time
Notepad++'s docking manager had already applied its saved layout. Moving
creation + DMM registration into OnNppReady lets Notepad++ restore the
panel's last-session visibility automatically. OnShowPanel reduces to a
visibility toggle.

README updated to list the Reveal in Explorer / Copy full path entries
in the file-operations section, and the roadmap section is trimmed to
reflect what has shipped.
Without this, every open buffer fires NPPN_FILEBEFORECLOSE during shutdown,
each one removing its file from the virtual tree before state.json is saved.
After restart the user's folders persisted but every file they had open at
shutdown was gone.

Listen for NPPN_BEFORESHUTDOWN to set a shutdown flag; restore it on
NPPN_CANCELSHUTDOWN (user backed out of save-dirty-files dialog). Skip
OnFileClosed cleanup while the flag is set so the tree survives intact.

Adds NPPN_BEFORESHUTDOWN/NPPN_CANCELSHUTDOWN to the local enum.
Previously, all non-rooted entries were stripped on load, so unsaved-buffer
references like "new 32" never survived a restart. With Notepad++'s session
backup enabled, those buffers DO persist with the same name across launches,
and the virtual entries were being deleted needlessly.

On NPPN_READY, fetch the current open-file list via NPPM_GETOPENFILENAMES
and only purge unsaved entries whose name doesn't match a live buffer.
Entries with a matching buffer stay; rooted (saved) entries always stay.
Per-path enumeration was only needed to verify NPPM_GETOPENFILENAMES vs.
stored paths during the smart-purge bring-up. The logic is confirmed
working, so reduce log noise to one line that only fires when entries
are actually purged.
OnNppShutdown previously only disposed the state store, leaving the panel
form (which owns a ToolTip, cached GDI brushes/pens, and an embedded
DarkAwareTreeView) and the 16x16 tab Icon to be finalized off-thread once
Notepad++ tore its window tree down. Dispose them synchronously so all
managed resources are released by the time Notepad++ regains control.

Adds shutdown breadcrumbs (entered / complete-in-Nms) so we can spot any
future shutdown-path regression without re-instrumenting from scratch.
… delay

README updates for the recent persistence work:
- Add a Persistence bullet for the new panel-visibility-survives-restart
  behavior (eager registration on NPPN_READY).
- Replace the stale "unsaved buffers are session-only" bullet with the
  correct smart-purge story: unsaved buffers survive a restart when
  Notepad++'s session backup is enabled, and stale references are silently
  cleaned up when it isn't.
- Note that auto-removal is suspended during Notepad++ shutdown so the
  per-tab close notifications don't strip every open file from the tree.
- Troubleshooting: add an explanation of the "Notepad++ takes two clicks
  to relaunch" symptom — caused by Notepad++ writing session backups for
  unsaved buffers, not the plugin (confirmed with plugin.log; our shutdown
  completes in ~30 ms).
@JamesShaver JamesShaver merged commit c6b2141 into main May 20, 2026
1 check failed
@JamesShaver JamesShaver deleted the v1.0.0-implementation branch May 20, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant