Buggy code:
class BufferPrintable implements Printable { BufferPrintable ( Buffer buffer , Font font , boolean header , boolean footer , boolean lineNumbers , boolean color ) { } public int print ( Graphics _gfx , PageFormat pageFormat , int pageIndex ) throws PrinterException { if ( pageIndex == ( currentPage ) ) currentLine = currentPageStart ; else { if ( end ) return Printable . NO_SUCH_PAGE ; currentPageStart = currentLine ; currentPage = pageIndex ; } double pageX = pageFormat . getImageableX ( ) ; double pageY = pageFormat . getImageableY ( ) ; double pageWidth = pageFormat . getImageableWidth ( ) ; double pageHeight = pageFormat . getImageableHeight ( ) ; Graphics2D gfx = ( ( Graphics2D ) ( _gfx ) ) ; gfx . setFont ( font ) ; if ( header ) { double headerHeight = paintHeader ( gfx , pageX , pageY , pageWidth ) ; pageY += headerHeight * 2 ; pageHeight -= headerHeight * 2 ; } if ( footer ) { double footerHeight = paintFooter ( gfx , pageX , pageY , pageWidth , pageHeight , pageIndex ) ; pageHeight -= footerHeight * 2 ; } FontRenderContext frc = gfx . getFontRenderContext ( ) ; 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>' ; double lineNumberWidth = font . getStringBounds ( chars , 0 , lineNumberDigits , frc ) . getWidth ( ) ; int tabSize = jEdit . getIntegerProperty ( "print.tabSize" , 8 ) ; 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 ( pageX , tabWidth ) ; Segment seg = new Segment ( ) ; double y = 0.0 ; print_loop : for ( ; ; ) { if ( ( currentLine ) == ( lineList . size ( ) ) ) { buffer . getLineText ( currentPhysicalLine , seg ) ; LineMetrics lm = font . getLineMetrics ( seg . array , seg . offset , seg . count , frc ) ; Token tokens = buffer . markTokens ( currentPhysicalLine ) . getFirstToken ( ) ; lineList . add ( new Integer ( ( ++ ( currentPhysicalLine ) ) ) ) ; ChunkCache . lineToChunkList ( seg , tokens , styles , frc , e , ( ( float ) ( pageWidth - lineNumberWidth ) ) , lineList ) ; if ( ( lineList . size ( ) ) == ( ( currentLine ) + 1 ) ) lineList . add ( null ) ; } y += lm . getHeight ( ) ; if ( y >= pageHeight ) break print_loop ; Object obj = lineList . get ( ( ( currentLine ) ++ ) ) ; if ( obj instanceof Integer ) { if ( lineNumbers ) { gfx . setFont ( font ) ; gfx . setColor ( BufferPrintable . lineNumberColor ) ; String lineNumberString = String . valueOf ( obj ) ; gfx . drawString ( lineNumberString , ( ( float ) ( pageX ) ) , ( ( float ) ( pageY + y ) ) ) ; } obj = lineList . get ( ( ( currentLine ) ++ ) ) ; } if ( obj != null ) { ChunkCache . Chunk line = ( ( ChunkCache . Chunk ) ( obj ) ) ; <START_BUG> ChunkCache . paintChunkList ( line , gfx , ( ( float ) ( pageX + lineNumberWidth ) ) , ( ( float ) ( pageY + y ) ) , ( ( float ) ( pageWidth - lineNumberWidth ) ) , Color . white ) ; <END_BUG> } if ( ( ( currentPhysicalLine ) == ( buffer . getLineCount ( ) ) ) && ( ( currentLine ) == ( lineList . size ( ) ) ) ) { end = true ; break print_loop ; } } return Printable . PAGE_EXISTS ; } 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 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 currentLine ; private int currentPhysicalLine ; private boolean end ; private LineMetrics lm ; private ArrayList lineList ; private double paintHeader ( Graphics2D gfx , double pageX , double pageY , double pageWidth ) { } private double paintFooter ( Graphics2D gfx , double pageX , double pageY , double pageWidth , double pageHeight , int pageIndex ) { } static class PrintTabExpander implements TabExpander { private double pageX ; private double tabWidth ; public PrintTabExpander ( double pageX , double tabWidth ) { } public float nextTabStop ( float x , int tabOffset ) { } } }

Fix:
ChunkCache . paintChunkList ( line , gfx , ( ( float ) ( pageX + lineNumberWidth ) ) , ( ( float ) ( pageY + y ) ) , ( ( float ) ( pageWidth - lineNumberWidth ) ) , Color . white , false ) ;