-
Notifications
You must be signed in to change notification settings - Fork 0
feat: source-code-compatible plugin system (V1) #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9b3621b
64fae21
e8f4d5e
7a9c12c
29e4141
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| #include "scintilla_bridge.h" | ||
| #include "file_monitor_mac.h" | ||
| #include "uchardet.h" | ||
| #include "plugin_manager.h" | ||
| #include "Notepad_plus_msgs.h" | ||
| #include "windows.h" | ||
| #include "commdlg.h" | ||
| #include "commctrl.h" | ||
|
|
@@ -206,6 +208,16 @@ bool openFileAtPath(NSString* path) | |
| addRecentFile(wpath); | ||
| rebuildRecentMenu(); | ||
| updateStatusBar(); | ||
|
|
||
| // Notify plugins that a file was opened | ||
| { | ||
| SCNotification notif{}; | ||
| notif.nmhdr.hwndFrom = ctx().mainHwnd; | ||
| notif.nmhdr.code = NPPN_FILEOPENED; | ||
| notif.nmhdr.idFrom = 0; // V1: no stable buffer ID yet | ||
| pluginManager().notify(¬if); | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -322,6 +334,15 @@ void saveCurrentFile() | |
|
|
||
| addRecentFile(doc.filePath); | ||
| rebuildRecentMenu(); | ||
|
|
||
| // Notify plugins that the file was saved | ||
| { | ||
| SCNotification notif{}; | ||
| notif.nmhdr.hwndFrom = ctx().mainHwnd; | ||
| notif.nmhdr.code = NPPN_FILESAVED; | ||
| notif.nmhdr.idFrom = 0; // V1: no stable buffer ID yet | ||
| pluginManager().notify(¬if); | ||
| } | ||
|
Comment on lines
+338
to
+345
|
||
| } | ||
|
|
||
| delete[] buf; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // nppm_handler.h — NPPM_* and RUNCOMMAND_USER message handlers | ||
| // Handles plugin messages sent via SendMessage(nppHandle, NPPM_*, ...) | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "windows.h" | ||
|
|
||
| LRESULT handleNppmMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
| LRESULT handleRunCommandMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds
NPPN_FILEOPENEDnotifications but always setsnmhdr.idFrom = 0. The PR description lists file notifications as a V2 limitation specifically because they require stable buffer IDs; sending these events in V1 (without IDs) can mislead plugins that treat the notification as fully supported. Either defer emitting these notifications until buffer IDs exist, or update the PR description/limitations to clarify the partial semantics.