question: protected void updateDamage ( DocumentEvent changes , Shape a , ViewFactory f ) { checkMetrics ( ) ; Component host = getContainer ( ) ; Element elem = getElement ( ) ; DocumentEvent . ElementChange ec = changes . getChange ( elem ) ; Element [ ] added = ( ec != null ) ? ec . getChildrenAdded ( ) : null ; Element [ ] removed = ( ec != null ) ? ec . getChildrenRemoved ( ) : null ; if ( ( ( added != null ) && ( added . length > 0 ) ) || ( ( removed != null ) && ( removed . length > 0 ) ) ) { if ( added != null && longestLine != null ) { int currentMaxWidth = getLineWidth ( longestLine ) ; for ( int i = 0 ; i < added . length ; i ++ ) { int width = getLineWidth ( added [ i ] ) ; if ( width > currentMaxWidth ) { currentMaxWidth = width ; longestLine = added [ i ] ; } } } if ( removed != null ) { for ( int i = 0 ; i < removed . length ; i ++ ) { if ( removed [ i ] == longestLine ) { longestLine = null ; break ; } } } preferenceChanged ( null , true , true ) ; host . repaint ( ) ; } else { Element map = getElement ( ) ; int line = map . getElementIndex ( changes . getOffset ( ) ) ; int endLine = map . getElementIndex ( changes . getOffset ( ) + changes . getLength ( ) ) ; damageLineRange ( line , endLine , a , host ) ; getLongestLine ( ) ; if ( changes . getType ( ) == DocumentEvent . EventType . INSERT ) { int w = getLineWidth ( longestLine ) ; Element e = map . getElement ( line ) ; if ( e == longestLine ) { preferenceChanged ( null , true , false ) ; } else if ( getLineWidth ( e ) > w ) { longestLine = e ; preferenceChanged ( null , true , false ) ; } } else if ( changes . getType ( ) == DocumentEvent . EventType . REMOVE ) { if ( map . getElement ( line ) == longestLine ) { determineLongestLine ( ) ; preferenceChanged ( null , true , false ) ; } } } }
target:  Mark the appropriate areas as needing a repaint after changes to the document.