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 9
9
using System . Runtime . InteropServices ;
10
10
using System . Text . RegularExpressions ;
11
11
using Kbg . NppPluginNET . PluginInfrastructure ;
12
+ using static Kbg . NppPluginNET . PluginInfrastructure . Win32 ;
12
13
13
14
namespace Kbg . NppPluginNET
14
15
{
@@ -126,6 +127,24 @@ static internal void CommandMenuInit()
126
127
PluginBase . SetCommand ( 14 , "---" , null ) ;
127
128
128
129
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
+ " ) ;
129
148
}
130
149
131
150
static internal void SetToolBarIcon ( )
You can’t perform that action at this time.
0 commit comments