@@ -1252,11 +1252,12 @@ protected void drawRows(Canvas canvas, float offset, LongArrayList postDrawLineN
12521252
12531253 // Draw matched text background
12541254 if (matchedPositions .size () > 0 ) {
1255+ var tr = createTextRow (row );
12551256 for (int i = 0 ; i < matchedPositions .size (); i ++) {
12561257 var position = matchedPositions .get (i );
12571258 var start = IntPair .getFirst (position );
12581259 var end = IntPair .getSecond (position );
1259- drawRowRegionBackground (canvas , row , start , end , rowInf .startColumn ,
1260+ drawRowRegionBackground (canvas , row , tr , start , end , rowInf .startColumn ,
12601261 rowInf .endColumn , editor .getColorScheme ().getColor (EditorColorScheme .MATCHED_TEXT_BACKGROUND ),
12611262 editor .getColorScheme ().getColor (EditorColorScheme .MATCHED_TEXT_BORDER ));
12621263 }
@@ -1265,10 +1266,11 @@ protected void drawRows(Canvas canvas, float offset, LongArrayList postDrawLineN
12651266 // Draw highlight text background
12661267 if (highlightPositions .getSize () > 0 ) {
12671268 int finalRow = row ;
1269+ var tr = createTextRow (row );
12681270 highlightPositions .forEach ((position , colorPair ) -> {
12691271 var start = IntPair .getFirst (position );
12701272 var end = IntPair .getSecond (position );
1271- drawRowRegionBackground (canvas , finalRow , start , end , rowInf .startColumn ,
1273+ drawRowRegionBackground (canvas , finalRow , tr , start , end , rowInf .startColumn ,
12721274 rowInf .endColumn , IntPair .getFirst (colorPair ), IntPair .getSecond (colorPair ));
12731275 return null ;
12741276 });
@@ -1293,7 +1295,7 @@ protected void drawRows(Canvas canvas, float offset, LongArrayList postDrawLineN
12931295 editor .getColorScheme ().getColor (EditorColorScheme .SELECTED_TEXT_BACKGROUND ),
12941296 editor .getColorScheme ().getColor (EditorColorScheme .SELECTED_TEXT_BORDER ));
12951297 } else if (selectionStart < selectionEnd ) {
1296- drawRowRegionBackground (canvas , row , selectionStart , selectionEnd , rowInf .startColumn , rowInf .endColumn ,
1298+ drawRowRegionBackground (canvas , row , null , selectionStart , selectionEnd , rowInf .startColumn , rowInf .endColumn ,
12971299 editor .getColorScheme ().getColor (EditorColorScheme .SELECTED_TEXT_BACKGROUND ),
12981300 editor .getColorScheme ().getColor (EditorColorScheme .SELECTED_TEXT_BORDER ));
12991301 }
@@ -1819,7 +1821,7 @@ protected int getRowBottomForBackground(int row) {
18191821 * @param highlightEnd Region end
18201822 * @param color Color of background
18211823 */
1822- protected void drawRowRegionBackground (Canvas canvas , int row , int highlightStart , int highlightEnd , int rowStart , int rowEnd , int color , int borderColor ) {
1824+ protected void drawRowRegionBackground (@ NonNull Canvas canvas , int row , @ Nullable TextRow tr , int highlightStart , int highlightEnd , int rowStart , int rowEnd , int color , int borderColor ) {
18231825 highlightStart = Math .max (highlightStart , rowStart );
18241826 highlightEnd = Math .min (highlightEnd , rowEnd );
18251827 if (highlightStart < highlightEnd ) {
@@ -1830,7 +1832,9 @@ protected void drawRowRegionBackground(Canvas canvas, int row, int highlightStar
18301832 offset += getMiniGraphWidth ();
18311833 }
18321834 float finalOffset = offset ;
1833- var tr = createTextRow (row );
1835+ if (tr == null ) {
1836+ tr = createTextRow (row );
1837+ }
18341838 var width = editor .getWidth ();
18351839 tr .iterateBackgroundRegions (highlightStart , highlightEnd , false , false , (left , right ) -> {
18361840 tmpRect .left = finalOffset + left ;
0 commit comments