TextCollector.st
changeset 2426 281067d406c7
parent 2371 8fa75853dae1
child 2450 4330a66d0b46
equal deleted inserted replaced
2425:f5eca590ec4f 2426:281067d406c7
   430 checkLineLimit
   430 checkLineLimit
   431     "this method checks if the text has become too large (> lineLimit)
   431     "this method checks if the text has become too large (> lineLimit)
   432      and cuts off some lines at the top if so; it must be called whenever lines
   432      and cuts off some lines at the top if so; it must be called whenever lines
   433      have been added to the bottom"
   433      have been added to the bottom"
   434 
   434 
   435     |nDel|
   435     |nDel newCursorLine|
   436 
   436 
   437     lineLimit notNil ifTrue:[
   437     lineLimit notNil ifTrue:[
   438 	(cursorLine > lineLimit) ifTrue:[
   438         (cursorLine > lineLimit) ifTrue:[
   439 	    nDel := list size - lineLimit.
   439             nDel := list size - lineLimit.
   440 	    list removeFromIndex:1 toIndex:nDel.
   440             list removeFromIndex:1 toIndex:nDel.
   441 	    cursorLine := cursorLine - nDel.
   441             newCursorLine := cursorLine - nDel.
   442 	    firstLineShown := firstLineShown - nDel.
   442             firstLineShown := firstLineShown - nDel.
   443 	    (firstLineShown < 1) ifTrue:[
   443             (firstLineShown < 1) ifTrue:[
   444 		cursorLine := cursorLine - firstLineShown + 1.
   444                 newCursorLine := newCursorLine - firstLineShown + 1.
   445 		firstLineShown := 1
   445                 firstLineShown := 1
   446 	    ].
   446             ].
   447 	    self contentsChanged
   447             self setCursorLine:newCursorLine.
   448 	]
   448             self contentsChanged
       
   449         ]
   449     ]
   450     ]
   450 !
   451 !
   451 
   452 
   452 installDelayedUpdate
   453 installDelayedUpdate
   453     "arrange for collecting input for some time,
   454     "arrange for collecting input for some time,
   783 ! !
   784 ! !
   784 
   785 
   785 !TextCollector class methodsFor:'documentation'!
   786 !TextCollector class methodsFor:'documentation'!
   786 
   787 
   787 version
   788 version
   788     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.67 2001-06-11 09:20:36 cg Exp $'
   789     ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.68 2001-10-04 12:59:02 cg Exp $'
   789 ! !
   790 ! !
   790 TextCollector initialize!
   791 TextCollector initialize!