@@ -1593,31 +1593,31 @@ void createCaretBitmaps() {
15931593 leftCaretBitmap .dispose ();
15941594 }
15951595 int lineHeight = renderer .getLineHeight ();
1596- leftCaretBitmap = new Image ( display , caretWidth , lineHeight );
1597- GC gc = new GC ( leftCaretBitmap );
1598- gc .setBackground ( display . getSystemColor ( SWT . COLOR_BLACK ) );
1599- gc .fillRectangle ( 0 , 0 , caretWidth , lineHeight );
1600- gc .setForeground ( display . getSystemColor ( SWT . COLOR_WHITE ) );
1601- gc .drawLine (0 ,0 ,0 , lineHeight );
1602- gc .drawLine (0 ,0 , caretWidth - 1 , 0 );
1603- gc . drawLine ( 0 , 1 , 1 , 1 ) ;
1604- gc . dispose ( );
1596+ final ImageGcDrawer imageGcDrawer = ( gc , width , height ) -> {
1597+ gc . setBackground ( display . getSystemColor ( SWT . COLOR_BLACK ) );
1598+ gc .fillRectangle ( 0 , 0 , width , height );
1599+ gc .setForeground ( display . getSystemColor ( SWT . COLOR_WHITE ) );
1600+ gc .drawLine ( 0 , 0 , 0 , height );
1601+ gc .drawLine (0 ,0 ,width - 1 , 0 );
1602+ gc .drawLine (0 ,1 , 1 , 1 );
1603+ } ;
1604+ leftCaretBitmap = new Image ( display , imageGcDrawer , caretWidth , lineHeight );
16051605
16061606 if (rightCaretBitmap != null ) {
16071607 if (defaultCaret != null && rightCaretBitmap .equals (defaultCaret .getImage ())) {
16081608 defaultCaret .setImage (null );
16091609 }
16101610 rightCaretBitmap .dispose ();
16111611 }
1612- rightCaretBitmap = new Image ( display , caretWidth , lineHeight );
1613- gc = new GC ( rightCaretBitmap );
1614- gc .setBackground ( display . getSystemColor ( SWT . COLOR_BLACK ) );
1615- gc .fillRectangle ( 0 , 0 , caretWidth , lineHeight );
1616- gc .setForeground ( display . getSystemColor ( SWT . COLOR_WHITE ) );
1617- gc .drawLine (caretWidth - 1 ,0 ,caretWidth -1 ,lineHeight );
1618- gc .drawLine (0 , 0 , caretWidth - 1 , 0 );
1619- gc . drawLine ( caretWidth - 1 , 1 , 1 , 1 ) ;
1620- gc . dispose ( );
1612+ final ImageGcDrawer imageGcDrawer1 = ( gc , width , height ) -> {
1613+ gc . setBackground ( display . getSystemColor ( SWT . COLOR_BLACK ) );
1614+ gc .fillRectangle ( 0 , 0 , width , height );
1615+ gc .setForeground ( display . getSystemColor ( SWT . COLOR_WHITE ) );
1616+ gc .drawLine ( width - 1 , 0 , width - 1 , height );
1617+ gc .drawLine (0 ,0 ,width -1 ,0 );
1618+ gc .drawLine (width - 1 , 1 , 1 , 1 );
1619+ } ;
1620+ rightCaretBitmap = new Image ( display , imageGcDrawer1 , caretWidth , lineHeight );
16211621}
16221622/**
16231623 * Moves the selected text to the clipboard. The text will be put in the
0 commit comments