@@ -107,11 +107,11 @@ private static SciApi Api {
107107 public void Reset ( ) {
108108 Init ( ) ;
109109 var scn = new SCNotification {
110- linesAdded = SciGetLineCount ( ) - 1 ,
111- position = 0 ,
112- length = SciGetLength ( )
110+ linesAdded = new IntPtr ( SciGetLineCount ( ) - 1 ) ,
111+ position = IntPtr . Zero ,
112+ length = new IntPtr ( SciGetLength ( ) )
113113 } ;
114- scn . text = Api . Send ( SciMsg . SCI_GETRANGEPOINTER , new IntPtr ( scn . position ) , new IntPtr ( scn . length ) ) ;
114+ scn . text = Api . Send ( SciMsg . SCI_GETRANGEPOINTER , scn . position , scn . length ) ;
115115 OnScnModified ( scn , true , Sci . Encoding ) ;
116116 }
117117
@@ -153,16 +153,16 @@ public void OnScnModified(SCNotification scn, bool isInsertion, Encoding encodin
153153 /// </summary>
154154 /// <param name="scn"></param>
155155 private void OnDeletedText ( SCNotification scn ) {
156- var startLine = SciLineFromPosition ( scn . position ) ;
157- if ( scn . linesAdded == 0 ) {
158- var delCharLenght = GetCharCount ( scn . text , scn . length ) ;
156+ var startLine = SciLineFromPosition ( scn . position . ToInt32 ( ) ) ;
157+ if ( scn . linesAdded == IntPtr . Zero ) {
158+ var delCharLenght = GetCharCount ( scn . text , scn . length . ToInt32 ( ) ) ;
159159 SetHoleInLine ( startLine , - delCharLenght ) ;
160160 } else {
161161 var lineByteStart = SciPositionFromLine ( startLine ) ;
162162 var lineByteLength = SciLineLength ( startLine ) ;
163163 var delCharLenght = - ( GetCharCount ( lineByteStart , lineByteLength ) - LineCharLength ( startLine ) ) ;
164164 FillTheHole ( ) ;
165- for ( int i = 0 ; i < - scn . linesAdded ; i ++ ) {
165+ for ( int i = 0 ; i < - scn . linesAdded . ToInt32 ( ) ; i ++ ) {
166166 delCharLenght += LineCharLength ( startLine + 1 ) ;
167167 _linesList . RemoveAt ( startLine + 1 ) ;
168168 }
@@ -176,9 +176,9 @@ private void OnDeletedText(SCNotification scn) {
176176 /// </summary>
177177 /// <param name="scn"></param>
178178 private void OnInsertedText ( SCNotification scn ) {
179- var startLine = SciLineFromPosition ( scn . position ) ;
180- if ( scn . linesAdded == 0 ) {
181- var insCharLenght = GetCharCount ( scn . text , scn . length ) ;
179+ var startLine = SciLineFromPosition ( scn . position . ToInt32 ( ) ) ;
180+ if ( scn . linesAdded == IntPtr . Zero ) {
181+ var insCharLenght = GetCharCount ( scn . text , scn . length . ToInt32 ( ) ) ;
182182 SetHoleInLine ( startLine , insCharLenght ) ;
183183 } else {
184184 var startCharPos = CharPositionFromLine ( startLine ) ;
@@ -187,7 +187,7 @@ private void OnInsertedText(SCNotification scn) {
187187 var lineCharLenght = GetCharCount ( lineByteStart , lineByteLength ) ;
188188 var insCharLenght = lineCharLenght - LineCharLength ( startLine ) ;
189189 FillTheHole ( ) ;
190- for ( int i = 0 ; i < scn . linesAdded ; i ++ ) {
190+ for ( int i = 0 ; i < scn . linesAdded . ToInt32 ( ) ; i ++ ) {
191191 startCharPos += lineCharLenght ;
192192 var line = startLine + i + 1 ;
193193 lineByteStart += lineByteLength ;
@@ -196,7 +196,7 @@ private void OnInsertedText(SCNotification scn) {
196196 insCharLenght += lineCharLenght ;
197197 _linesList . Insert ( line , startCharPos ) ;
198198 }
199- SetHoleInLine ( startLine + scn . linesAdded , insCharLenght ) ;
199+ SetHoleInLine ( startLine + scn . linesAdded . ToInt32 ( ) , insCharLenght ) ;
200200 FillTheHole ( ) ;
201201
202202 // We should not have a null length, but we actually can :
@@ -205,7 +205,7 @@ private void OnInsertedText(SCNotification scn) {
205205 // so in that case, we need to refresh the info when the text is actually inserted, that is after updateui
206206 // Clarification : the notification sent is correct (nb lines > 0, length, text are ok), but calling SciLineLength
207207 // will always return 0 at this moment!
208- if ( scn . length > 0 && TextLength == 0 )
208+ if ( scn . length . ToInt32 ( ) > 0 && TextLength == 0 )
209209 NotificationsPublisher . ActionsAfterUpdateUi . Enqueue ( Reset ) ;
210210 }
211211 }
0 commit comments