Class new title: ListPane subclassof: Textframe fields: 'list firstShown lastShown selection scrollBar' declare: '' close [selection _ 0. scrollBar close] compselection [selection  0  [self selectionRect comp]] deselected dirty [false] displayall [self displaylines: firstShown to: lastShown] dummy [''] eachtime [[window has: user mp  [user kbck  [self kbd] [user anybug  [user redbug  [self redbug] user yellowbug  [self yellowbug] user bluebug  [false]]]. user anykeys  [self keyset]]]. self outside] enter [scrollBar show] fill [[firstShown  nil  [self makeParagraph] lastShown _ self lineofy: window maxY - (style lineheight - 1)]. [self locked or selection > 0  [selection < firstShown  [frame origin y_ window minY - (selection * style lineheight) + style lineheight] selection > lastShown  [frame origin y_ window minY - (selection * style lineheight + style lineheight) + (window maxY - window minY | style lineheight) min: window minY]]]. firstShown _ self lineofy: window minY + (style lineheight - 1). lastShown _ self lineofy: window maxY - (style lineheight - 1)] firstShown: t1 | t2 t3 [t2 _ t1 - firstShown. t3 _ 0  (0 - t2 * style lineheight). firstShown _ t1. lastShown _ lastShown + t2. frame moveby: t3. (window origin - t3 rect: window corner) blt: window origin mode: storing. self displaylines: (firstShown max: lastShown - t2 + 1) to: lastShown] firsttime [window has: user mp  [self enter] false] frame_ t1 [window _ t1. frame _ window inset: 2  0 and: 0  0. frame width_ 999. self fill. scrollBar _ [scrollBar  nil  [ScrollBar new] scrollBar] on: window from: self] grayselection [selection  0  [self selectionRect color: ltgray mode: oring]] init [self para: nil frame: nil] kbd [window flash. user kbd] keyset | t1 t2 [t1 _ user currentCursor. self scrollControl [t2 _ user keyset. [t2 = 6  [2] t2 = 12  [2] t2 = 2  [1] t2 = 8  [1] 0]]. t1 show] lastShown: t1 | t2 t3 [t2 _ t1 - lastShown. t3 _ 0  (0 - t2 * style lineheight). lastShown _ t1. firstShown _ firstShown + t2. frame moveby: t3. (Rectangle new origin: window origin extent: window width  (window height - t3 y | style lineheight)) blt: window origin + t3 mode: storing. self displaylines: firstShown to: (firstShown - t2 - 1 min: lastShown)] lasttime [self leave] leave [scrollBar hide] locked [[selection = 0  [false] self dirty]] makeParagraph | t1 t2 t3 [[firstShown  nil  [firstShown _ 1. selection _ 0]]. t3 _ (String new: 200) asStream. t3 append: self dummy. t3 cr. [list  nil  [] for t1 to: list length do [list  t1 printon: t3. t3 cr]]. t3 append: self dummy. t3 cr. para _ t3 contents asParagraph. self measureall. lastShown _ self lineofy: window maxY - (style lineheight - 1). frame corner y_ (self yofline: lastline) + style lineheight. selection > lastShown  [selection _ 0]] of: t1 [list _ t1. selection _ 0. self makeParagraph. self frame_ window. self outline. self displayall. self deselected] outline [window outline: 1] outside [scrollBar startup] picked [window has: user mp] redbug | t1 t2 [t2 _ self locked. [t2  [] self compselection. t1 _ ((self lineofy: user mp y) max: 1) - 1. XeqCursor showwhile [self select: [t1 = selection  [0] t1]]]. while (user anybug and (window has: user mp)) do [t2  [t2 flash. self compselection. self compselection]]] revise: t1 with: t2 | t3 [t3 _ list  t1. [t3  [list _ t1. self makeParagraph. self fill. self displayall] selection > 0  [t3 _ list  selection  t2. t3  [self compselection]] t3 _ true]. t3  [selection _ 1. self select: (list find: t2)]] scrollPos [(firstShown  nil or list  nil) or list length = 0  [0.0] (firstShown - 1) asFloat / list length] scrollTo: t1 | t2 t3 [self scrollUp: (t1 * lastline) asInteger - firstShown + 1 * style lineheight] scrollUp: t1 | t2 [self compselection. t1 _ t1 | style lineheight. t2 _ (self lineofy: window minY + t1) max: 1. [t1 > 0  [lastline = lastShown  [] self locked  [selection + 1 = firstShown  [window flash] self firstShown: (t2 min: selection + 1)] self firstShown: (t2 min: lastline - (window height / style lineheight) + 1)] firstShown = 1  [] self locked  [selection + 1 = lastShown  [window flash] self lastShown: (lastShown - (firstShown - t2) max: selection + 1)] self lastShown: (lastShown - (firstShown - t2) max: (lastline min: window height / style lineheight))]. (window origin x  ((self yofline: lastline) + style lineheight) rect: window corner) clear: white. self select: selection] select: t1 | t2 [t2 _ selection. (1 max: firstShown - 1)  t1 and t1  (list length min: lastShown - 1)  [selection _ t1. self compselection. t2  selection  [self selected]] selection _ 0. t2  selection  [self deselected]] selected selectionRect | t1 [t1 _ selection * style lineheight + frame minY. (Rectangle new origin: frame minX  t1 corner: frame maxX  (t1 + style lineheight)) intersect: window] windowenter [self outline. self displayall. self compselection] windowleave [self compselection. self grayselection] yellowbug [window flash]