@@ -122,8 +122,7 @@ public void OnNotification(ScNotification notification)
122122 //Update the scintilla handle in all cases to keep track of which instance is active
123123 UpdateEditorInformation ( ) ;
124124 this . Editor . CurrentBufferID = notification . Header . IdFrom ;
125- this . updateRenderer = true ;
126- Update ( true ) ;
125+ Update ( true , true ) ;
127126 }
128127 else if ( notification . Header . Code == ( uint ) SciMsg . SCN_MODIFIED && ! this . updateRenderer )
129128 {
@@ -140,12 +139,14 @@ public void OnNotification(ScNotification notification)
140139 ///
141140 /// </summary>
142141 /// <param name="updateScrollBar"></param>
143- protected void Update ( bool updateScrollBar = false )
142+ /// <param name="updateRenderer"></param>
143+ public void Update ( bool updateScrollBar = false , bool updateRenderer = false )
144144 {
145145 //Validate that the current file may be rendered
146146 if ( this . configuration . ValidateFileExtension ( this . currentFileExtension , this . currentFileName ) )
147147 {
148148 //Update the view
149+ this . updateRenderer = updateRenderer ? updateRenderer : this . updateRenderer ;
149150 UpdateMarkdownViewer ( ) ;
150151 //Update the scroll bar of the Viewer Panel only in case of vertical scrolls
151152 if ( this . configuration . options . synchronizeScrolling && updateScrollBar )
@@ -158,7 +159,7 @@ protected void Update(bool updateScrollBar = false)
158159 this . renderer . Render ( $@ "<p>
159160Your configuration settings do not include the currently selected file extension.<br />
160161The rendered file extensions are <b>'{ this . configuration . options . fileExtensions } '</b>.<br />
161- The current file is <i>'{ this . currentFileName } '</i>. { this . Editor . GetModify ( ) }
162+ The current file is <i>'{ this . currentFileName } '</i>.
162163 </p>" ) ;
163164 }
164165 }
@@ -203,6 +204,8 @@ private void OptionsCommand()
203204 {
204205 options . ShowDialog ( Control . FromHandle ( PluginBase . GetCurrentScintilla ( ) ) ) ;
205206 }
207+ //Update after something potentially changed in the settings dialog
208+ Update ( true , true ) ;
206209 }
207210
208211 /// <summary>
@@ -251,8 +254,7 @@ public void MarkdownViewerCommand()
251254 if ( ! this . renderer . Visible )
252255 {
253256 UpdateEditorInformation ( ) ;
254- this . updateRenderer = true ;
255- Update ( true ) ;
257+ Update ( true , true ) ;
256258 }
257259 ToggleToolbarIcon ( ! this . renderer . Visible ) ;
258260 }
@@ -265,6 +267,7 @@ protected void UpdateEditorInformation()
265267 this . Editor . SetScintillaHandle ( PluginBase . GetCurrentScintilla ( ) ) ;
266268 this . currentFileName = this . Notepad . GetCurrentFileName ( ) ;
267269 this . currentFileExtension = Path . GetExtension ( this . currentFileName ) ;
270+ this . currentFileExtension = this . currentFileExtension . StartsWith ( "." ) ? this . currentFileExtension . Substring ( 1 , this . currentFileExtension . Length - 1 ) : this . currentFileExtension ;
268271 }
269272
270273 /// <summary>
@@ -286,7 +289,7 @@ public void ToggleToolbarIcon(bool show = true)
286289 /// <summary>
287290 ///
288291 /// </summary>
289- public void UpdateMarkdownViewer ( )
292+ protected void UpdateMarkdownViewer ( )
290293 {
291294 try
292295 {
0 commit comments