Buggy code:
class BufferPrintable extends WorkRequest implements Printable { BufferPrintable ( PrinterJob job , Object format , View view , Buffer buffer , Font font , boolean header , boolean footer , boolean lineNumbers , boolean color ) { } public void run ( ) { } public int print ( Graphics _gfx , PageFormat pageFormat , int pageIndex ) throws PrinterException { } private static Color headerColor = Color . lightGray ; private static Color headerTextColor = Color . black ; private static Color footerColor = Color . lightGray ; private static Color footerTextColor = Color . black ; private static Color lineNumberColor = Color . gray ; private static Color textColor = Color . black ; private PrinterJob job ; private Object format ; private View view ; private Buffer buffer ; private Font font ; private SyntaxStyle [ ] styles ; private boolean header ; private boolean footer ; private boolean lineNumbers ; private int currentPage ; private int currentPageStart ; private int currentPhysicalLine ; private boolean end ; private LineMetrics lm ; private ArrayList lineList ; private DisplayTokenHandler tokenHandler ; private void printPage ( Graphics _gfx , PageFormat pageFormat , int pageIndex , boolean actuallyPaint ) { Graphics2D gfx = ( ( Graphics2D ) ( _gfx ) ) ; gfx . setFont ( font ) ; double pageX = pageFormat . getImageableX ( ) ; double pageY = pageFormat . getImageableY ( ) ; double pageWidth = pageFormat . getImageableWidth ( ) ; double pageHeight = pageFormat . getImageableHeight ( ) ; if ( header ) { double headerHeight = paintHeader ( gfx , pageX , pageY , pageWidth , actuallyPaint ) ; pageY += headerHeight ; pageHeight -= headerHeight ; } if ( footer ) { double footerHeight = paintFooter ( gfx , pageX , pageY , pageWidth , pageHeight , pageIndex , actuallyPaint ) ; pageHeight -= footerHeight ; } FontRenderContext frc = gfx . getFontRenderContext ( ) ; double lineNumberWidth ; if ( lineNumbers ) { int lineNumberDigits = ( ( int ) ( Math . ceil ( ( ( Math . log ( ( ( buffer . getLineCount ( ) ) + 1 ) ) ) // ( Math . log ( 10 ) ) ) ) ) ) + 1 ; char [ ] chars = new char [ lineNumberDigits ] ; for ( int i = 0 ; i < ( chars . length ) ; i ++ ) chars [ i ] = '<seq2seq4repair_space>' ; lineNumberWidth = font . getStringBounds ( chars , 0 , lineNumberDigits , frc ) . getWidth ( ) ; } else lineNumberWidth = 0.0 ; int tabSize = jEdit . getIntegerProperty ( "print.tabSize" , 8 ) ; char [ ] chars = new char [ tabSize ] ; for ( int i = 0 ; i < ( chars . length ) ; i ++ ) chars [ i ] = '<seq2seq4repair_space>' ; double tabWidth = font . getStringBounds ( chars , 0 , tabSize , frc ) . getWidth ( ) ; BufferPrintable . PrintTabExpander e = new BufferPrintable . PrintTabExpander ( tabWidth ) ; Segment seg = new Segment ( ) ; double y = 0.0 ; lm = font . getLineMetrics ( "gGyYX" , frc ) ; print_loop : for ( ; ; ) { if ( ( currentPhysicalLine ) == ( buffer . getLineCount ( ) ) ) { end = true ; break print_loop ; } lineList . clear ( ) ; buffer . getLineText ( currentPhysicalLine , seg ) ; tokenHandler . init ( seg , styles , frc , e , lineList , ( ( float ) ( pageWidth - lineNumberWidth ) ) ) ; buffer . markTokens ( currentPhysicalLine , tokenHandler ) ; if ( ( lineList . size ( ) ) == 0 ) lineList . add ( null ) ; if ( ( y + ( ( lm . getHeight ( ) ) * ( lineList . size ( ) ) ) ) >= pageHeight ) break print_loop ; if ( ( lineNumbers ) && actuallyPaint ) { gfx . setFont ( font ) ; gfx . setColor ( BufferPrintable . lineNumberColor ) ; gfx . drawString ( String . valueOf ( ( ( currentPhysicalLine ) + 1 ) ) , ( ( float ) ( pageX ) ) , ( ( float ) ( ( pageY + y ) + ( lm . getHeight ( ) ) ) ) ) ; } for ( int i = 0 ; i < ( lineList . size ( ) ) ; i ++ ) { y += lm . getHeight ( ) ; Chunk chunks = ( ( Chunk ) ( lineList . get ( i ) ) ) ; if ( ( chunks != null ) && actuallyPaint ) { Chunk . paintChunkBackgrounds ( chunks , gfx , ( ( float ) ( pageX + lineNumberWidth ) ) , ( ( float ) ( pageY + y ) ) ) ; <START_BUG> Chunk . paintChunkList ( seg , chunks , gfx , ( ( float ) ( pageX + lineNumberWidth ) ) , ( ( float ) ( pageY + y ) ) , false ) ; <END_BUG> } } ( currentPhysicalLine ) ++ ; } } private double paintHeader ( Graphics2D gfx , double pageX , double pageY , double pageWidth , boolean actuallyPaint ) { } private double paintFooter ( Graphics2D gfx , double pageX , double pageY , double pageWidth , double pageHeight , int pageIndex , boolean actuallyPaint ) { } static class PrintTabExpander implements TabExpander { private double tabWidth ; public PrintTabExpander ( double tabWidth ) { } public float nextTabStop ( float x , int tabOffset ) { } } }

Fix:
Chunk . paintChunkList ( chunks , gfx , ( ( float ) ( pageX + lineNumberWidth ) ) , ( ( float ) ( pageY + y ) ) , false ) ;