From 99dcf0183a3f86ae80cb2e6991397a22bb7f73aa Mon Sep 17 00:00:00 2001 From: molsonkiko <46202915+molsonkiko@users.noreply.github.com> Date: Sun, 29 Dec 2024 10:50:32 -0800 Subject: [PATCH] fix bug in notepad.GetOpenFileNames now it won't falsely list a "new 1" file for an invisible view (if the mainView or subView is closed, it always has a dummy buffer even though it's not visible) --- JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs | 6 ++++-- JsonToolsNppPlugin/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs b/JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs index a780ec1..17a8a71 100644 --- a/JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs +++ b/JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs @@ -224,8 +224,7 @@ public int[] GetNppVersion() } /// - /// Get all open filenames in both views (all in first view, then all in second view).

- /// Note that if the second view is not open, the last name in the array will be "new 1" because that is the name of the placeholder buffer that is always in an empty view. + /// Get all open filenames in both views (all in first view, then all in second view). ///
/// public string[] GetOpenFileNames() @@ -233,6 +232,9 @@ public string[] GetOpenFileNames() var bufs = new List(); for (int view = 0; view < 2; view++) { + int curBufIdx = (int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTDOCINDEX, 0, view); + if (curBufIdx == -1) + continue; // NPPM_GETCURRENTDOCINDEX(0, view) returns -1 if that view is invisible int nbOpenFiles = (int)Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNBOPENFILES, 0, view + 1); for (int ii = 0; ii < nbOpenFiles; ii++) { diff --git a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs index 70333d1..1341c20 100644 --- a/JsonToolsNppPlugin/Properties/AssemblyInfo.cs +++ b/JsonToolsNppPlugin/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("8.3.1.2")] -[assembly: AssemblyFileVersion("8.3.1.2")] +[assembly: AssemblyVersion("8.3.1.3")] +[assembly: AssemblyFileVersion("8.3.1.3")]