This repository was archived by the owner on Jan 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Demo Plugin/NppManagedPluginDemo Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 99using System . Runtime . InteropServices ;
1010using System . Text . RegularExpressions ;
1111using Kbg . NppPluginNET . PluginInfrastructure ;
12+ using static Kbg . NppPluginNET . PluginInfrastructure . Win32 ;
1213
1314namespace Kbg . NppPluginNET
1415{
@@ -126,6 +127,24 @@ static internal void CommandMenuInit()
126127 PluginBase . SetCommand ( 14 , "---" , null ) ;
127128
128129 PluginBase . SetCommand ( 15 , "Dockable Dialog Demo" , DockableDlgDemo ) ; idFrmGotToLine = 15 ;
130+
131+ PluginBase . SetCommand ( 16 , "---" , null ) ;
132+
133+ PluginBase . SetCommand ( 17 , "Print Scroll and Row Information" , PrintScrollInformation ) ;
134+ }
135+
136+ /// <summary>
137+ ///
138+ /// </summary>
139+ static void PrintScrollInformation ( )
140+ {
141+ ScrollInfo scrollInfo = editor . GetScrollInfo ( ScrollInfoMask . SIF_RANGE | ScrollInfoMask . SIF_TRACKPOS | ScrollInfoMask . SIF_PAGE , ScrollInfoBar . SB_VERT ) ;
142+ var scrollRatio = ( double ) scrollInfo . nTrackPos / ( scrollInfo . nMax - scrollInfo . nPage ) ;
143+ var scrollPercentage = Math . Min ( scrollRatio , 1 ) * 100 ;
144+ editor . ReplaceSel ( $@ "The maximum row in the current document was { scrollInfo . nMax + 1 } .
145+ A maximum of { scrollInfo . nPage } rows is visible at a time.
146+ The current scroll ratio is { Math . Round ( scrollPercentage , 2 ) } %.
147+ " ) ;
129148 }
130149
131150 static internal void SetToolBarIcon ( )
You can’t perform that action at this time.
0 commit comments