File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ private void InjectBG(boolean inject) {
154
154
universal_buffer .setLength (0 );
155
155
universal_buffer .append (data , 0 , removeSt -1 );
156
156
universal_buffer .append (data , removeEd +1 , length );
157
- tweaker .setDocumentText (universal_buffer );
157
+ tweaker .setDocumentText (universal_buffer , -( removeEd - removeSt + 2 ) );
158
158
}
159
159
}
160
160
if (!removed ) {
@@ -170,7 +170,7 @@ private void InjectBG(boolean inject) {
170
170
universal_buffer .append (data , 0 , insIdx );
171
171
universal_buffer .append (text );
172
172
universal_buffer .append (data , insIdx , length );
173
- tweaker .setDocumentText (universal_buffer );
173
+ tweaker .setDocumentText (universal_buffer , text . length () );
174
174
}
175
175
}
176
176
}
Original file line number Diff line number Diff line change @@ -552,9 +552,15 @@ private void doIt() {
552
552
}
553
553
}
554
554
555
- void setDocumentText (CharSequence text ) {
555
+ void setDocumentText (CharSequence text , int selOffset ) {
556
556
if (mDocument !=null ){
557
- WriteCommandAction .runWriteCommandAction (mProject , ()-> mDocument .setText (text ));
557
+ WriteCommandAction .runWriteCommandAction (mProject , ()-> {
558
+ mDocument .setText (text );
559
+ if (currentStart <currentEnd && currentStart >=0 ) {
560
+ currentStart +=selOffset ;
561
+ currentEnd +=selOffset ;
562
+ }
563
+ });
558
564
}
559
565
}
560
566
You can’t perform that action at this time.
0 commit comments