NppMarkdownPanel
NppMarkdownPanel copied to clipboard
`NppTbData.pszModuleName` is not properly assigned when Markdown panel is docked
A forum user asked a while ago why N++'s built-in Docking Manager never reloads the MarkdownViewer++ panel when the application starts. This goes for NppMarkdownPanel as well, and for the same reason, so I'm cross-posting nea/MarkdownViewerPlusPlus#159.
The problem is the plugin's module name is serialized without a file extension. N++ fails to locate the module on disk, so never calls NppMarkdownPanel.MarkdownPanelController.TogglePanelVisible() when starting up.
See what happens when the file extension is written to config.xml as the TogglePanelVisible method should be doing.
- Click
Toggle Markdown Paneland leave the panel showing - Quit Notepad++
- Open
%AppData%\Notepad++\config.xml(if you have a system-wide installation), or theconfig.xmlinside your portable installation - Notice that
NppMarkdownPanel.Main.ModuleNameis the value of thepluginNameattribute, e.g.,
<GUIConfig name="DockingManager" leftWidth="200" rightWidth="664" topHeight="200" bottomHeight="200">
<PluginDlg pluginName="NppMarkdownPanel" id="0" curr="1" prev="-1" isVisible="yes" />
<!-- . . . -->
</GUIConfig>
- Edit the XML to
pluginName="NppMarkdownPanel.dll", i.e., append the module's file extension; make sureisVisibleremains"yes" - Start Notepad++
- The panel is automatically opened
A tiny patch is all that's needed to make this the default behaviour:
--- a/NppMarkdownPanel/MarkdownPanelController.cs
+++ b/NppMarkdownPanel/MarkdownPanelController.cs
@@ -298 +298 @@ namespace NppMarkdownPanel
- _nppTbData.pszModuleName = Main.ModuleName;
+ _nppTbData.pszModuleName = $"{Main.ModuleName}.dll";