BrowserView.st
changeset 2428 46edc54e3e0e
parent 2425 0536e1b9504e
child 2429 fe077224ade0
equal deleted inserted replaced
2427:6b611af5eb4f 2428:46edc54e3e0e
 13009 syntaxHighlightedCode:newCode
 13009 syntaxHighlightedCode:newCode
 13010     "the background highlighter has generated new colored text,
 13010     "the background highlighter has generated new colored text,
 13011      with highlighted syntax.
 13011      with highlighted syntax.
 13012      If there have been no modifications in the meantime, install it."
 13012      If there have been no modifications in the meantime, install it."
 13013 
 13013 
 13014     |firstShown lastShown sensor cursorWasOn anyChange|
 13014     |firstShown lastShown sensor cursorWasOn anyChange newLines l
       
 13015      replaceAction|
 13015 
 13016 
 13016     codeView modified ifTrue:[
 13017     codeView modified ifTrue:[
 13017         "/ new input arrived in the meantime
 13018         "/ new input arrived in the meantime
 13018         ^ self
 13019         ^ self
 13019     ].
 13020     ].
 13035 
 13036 
 13036     firstShown := codeView firstLineShown.
 13037     firstShown := codeView firstLineShown.
 13037     lastShown := codeView lastLineShown.
 13038     lastShown := codeView lastLineShown.
 13038     sensor := self sensor.
 13039     sensor := self sensor.
 13039 
 13040 
 13040     anyChange := false.
 13041     replaceAction := [:lNr :line |
 13041 
       
 13042     newCode asStringCollection keysAndValuesDo:[:lNr :line |
       
 13043         |oldLine|
 13042         |oldLine|
 13044 
 13043 
 13045         oldLine := codeView listAt:lNr.
 13044         oldLine := codeView listAt:lNr.
 13046         oldLine notNil ifTrue:[
 13045         oldLine notNil ifTrue:[
 13047             line notNil ifTrue:[
 13046             line notNil ifTrue:[
 13074                 (anyChange and:[cursorWasOn]) ifTrue:[codeView showCursor].
 13073                 (anyChange and:[cursorWasOn]) ifTrue:[codeView showCursor].
 13075                 ^ self.
 13074                 ^ self.
 13076             ]
 13075             ]
 13077         ]
 13076         ]
 13078     ].
 13077     ].
       
 13078 
       
 13079     anyChange := false.
       
 13080 
       
 13081     newLines := newCode asStringCollection.
       
 13082 
       
 13083     "/ the cursor line first - thats where your eyes are ...
       
 13084     (l := codeView cursorLine) notNil ifTrue:[
       
 13085         l <= newLines size ifTrue:[
       
 13086             replaceAction value:l value:(newLines at:l)
       
 13087         ]
       
 13088     ].
       
 13089 
       
 13090     newLines keysAndValuesDo:replaceAction.
       
 13091 
 13079     (anyChange and:[cursorWasOn]) ifTrue:[codeView showCursor].
 13092     (anyChange and:[cursorWasOn]) ifTrue:[codeView showCursor].
 13080 
 13093 
 13081     "Modified: / 5.2.1999 / 22:29:17 / cg"
 13094     "Modified: / 5.2.1999 / 22:29:17 / cg"
 13082 ! !
 13095 ! !
 13083 
 13096 
 13961 ! !
 13974 ! !
 13962 
 13975 
 13963 !BrowserView class methodsFor:'documentation'!
 13976 !BrowserView class methodsFor:'documentation'!
 13964 
 13977 
 13965 version
 13978 version
 13966     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.565 1999-10-10 12:44:27 cg Exp $'
 13979     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.566 1999-10-14 14:08:09 cg Exp $'
 13967 ! !
 13980 ! !
 13968 BrowserView initialize!
 13981 BrowserView initialize!