Skip to content

Commit

Permalink
fix bug in notepad.GetOpenFileNames
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
molsonkiko committed Dec 29, 2024
1 parent f2d8ad2 commit 99dcf01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions JsonToolsNppPlugin/PluginInfrastructure/NotepadPPGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,17 @@ public int[] GetNppVersion()
}

/// <summary>
/// Get all open filenames in both views (all in first view, then all in second view).<br></br>
/// 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).
/// </summary>
/// <returns></returns>
public string[] GetOpenFileNames()
{
var bufs = new List<string>();
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++)
{
Expand Down
4 changes: 2 additions & 2 deletions JsonToolsNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit 99dcf01

Please sign in to comment.