--- a/TextView.st Sat Dec 05 14:34:27 1998 +0100
+++ b/TextView.st Thu Jan 07 13:09:16 1999 +0100
@@ -16,7 +16,8 @@
clickCount expandingTop wordStartCol wordStartLine wordEndCol
wordEndLine selectionFgColor selectionBgColor selectStyle
directoryForFileDialog defaultFileNameForFileDialog
- externalEncoding contentsWasSaved'
+ externalEncoding contentsWasSaved
+ lastSearchPattern lastSearchIgnoredCase lastSearchDirection'
classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
DefaultSelectionBackgroundColor MatchDelayTime
WordSelectCatchesBlanks ST80Selections LastSearchPatterns'
@@ -72,16 +73,16 @@
contentsWasSaved <Boolean> set to true, whenever saved in a file
externalEncoding <Symbol|nil> external encoding, used when text is saved to
- a file. Usually something like
- #jis7, #euc, #sjis etc.
- (currently only passed down from the
- fileBrowser)
+ a file. Usually something like
+ #jis7, #euc, #sjis etc.
+ (currently only passed down from the
+ fileBrowser)
[class variables:]
- ST80Selections <Boolean> enables ST80 style doubleclick behavior
- (right after opening parenthesis, right before
- closing parenthesis, at begin of a line
- at begin of text)
+ ST80Selections <Boolean> enables ST80 style doubleclick behavior
+ (right after opening parenthesis, right before
+ closing parenthesis, at begin of a line
+ at begin of text)
[StyleSheet parameters:]
@@ -92,10 +93,10 @@
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- EditTextView CodeView Workspace
+ EditTextView CodeView Workspace
"
!
@@ -106,18 +107,18 @@
they may also be opened as a textEditor;
open a (readonly) textView on some information text:
- [exBegin]
- TextView
- openWith:'read this'
- title:'demonstration'
- [exEnd]
+ [exBegin]
+ TextView
+ openWith:'read this'
+ title:'demonstration'
+ [exEnd]
the same, but open it modal:
- [exBegin]
- TextView
- openModalWith:'read this first'
- title:'demonstration'
- [exEnd]
+ [exBegin]
+ TextView
+ openModalWith:'read this first'
+ title:'demonstration'
+ [exEnd]
open it modal (but editable) on some text:
@@ -128,26 +129,26 @@
However, usually an applicationModel is installed as the
editor-topViews application. This would get a closeRequest,
where it could handle things.
- [exBegin]
- |m textView|
-
- m := 'read this first' asValue.
- textView := EditTextView openModalOnModel:m.
- textView modified ifTrue:[
- (self confirm:'text was not accepted - do it now ?')
- ifTrue:[
- m value:textView contents
- ]
- ].
-
- Transcript showCR:m value.
- [exEnd]
+ [exBegin]
+ |m textView|
+
+ m := 'read this first' asValue.
+ textView := EditTextView openModalOnModel:m.
+ textView modified ifTrue:[
+ (self confirm:'text was not accepted - do it now ?')
+ ifTrue:[
+ m value:textView contents
+ ]
+ ].
+
+ Transcript showCR:m value.
+ [exEnd]
open a textEditor on some file:
- [exBegin]
- EditTextView openOn:'Makefile'
- [exEnd]
+ [exBegin]
+ EditTextView openOn:'Makefile'
+ [exEnd]
"
@@ -178,14 +179,14 @@
i := self classResources at:'ICON' default:nil.
i isNil ifTrue:[
- nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
- i := Image fromFile:nm resolution:100.
- i isNil ifTrue:[
- i := Image fromFile:('bitmaps/' , nm) resolution:100.
- ]
+ nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
+ i := Image fromFile:nm resolution:100.
+ i isNil ifTrue:[
+ i := Image fromFile:('bitmaps/' , nm) resolution:100.
+ ]
].
i notNil ifTrue:[
- i := i on:Display
+ i := i on:Display
].
^ i
@@ -210,9 +211,9 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'textView.background'
- #'text.selectionForegroundColor' #'text.selectionBackgroundColor'
- #'textView.font' #'text.wordSelectCatchesBlanks'
- #'text.st80Selections')>
+ #'text.selectionForegroundColor' #'text.selectionBackgroundColor'
+ #'textView.font' #'text.wordSelectCatchesBlanks'
+ #'text.st80Selections')>
DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White.
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
@@ -347,9 +348,9 @@
top := StandardSystemView label:label icon:self defaultIcon.
frame := HVScrollableView
- for:self
- miniScrollerH:true miniScrollerV:false
- in:top.
+ for:self
+ miniScrollerH:true miniScrollerV:false
+ in:top.
frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
^ frame scrolledView
@@ -365,8 +366,8 @@
top := textView topView.
aFileName notNil ifTrue:[
f := aFileName asFilename.
- top label:(f baseName).
- textView contents:(f contents).
+ top label:(f baseName).
+ textView contents:(f contents).
].
^ textView
@@ -397,7 +398,7 @@
aTitle notNil ifTrue:[top label:aTitle].
aStringOrStringCollection notNil ifTrue:[
- textView contents:aStringOrStringCollection
+ textView contents:aStringOrStringCollection
].
^ textView
@@ -432,7 +433,7 @@
selectionStartLine isNil ifTrue:[^ 0].
^ self characterPositionOfLine:selectionStartLine
- col:selectionStartCol
+ col:selectionStartCol
"Modified: 14.8.1997 / 16:35:37 / cg"
!
@@ -443,7 +444,7 @@
selectionStartLine isNil ifTrue:[^ 0].
^ self characterPositionOfLine:selectionEndLine
- col:selectionEndCol
+ col:selectionEndCol
"Created: 14.8.1997 / 16:35:24 / cg"
"Modified: 14.8.1997 / 16:35:45 / cg"
@@ -520,9 +521,9 @@
super setContents:something.
selStartLine notNil ifTrue:[
- self
- selectFromLine:selStartLine col:selStartCol
- toLine:selEndLine col:selEndCol.
+ self
+ selectFromLine:selStartLine col:selStartCol
+ toLine:selEndLine col:selEndCol.
].
selectStyle := selStyle
@@ -562,35 +563,35 @@
beginCol := self findBeginOfWordAtLine:selectLine col:selectCol.
endCol := self findEndOfWordAtLine:selectLine col:selectCol.
endCol == 0 ifTrue:[
- endLine := selectLine + 1
+ endLine := selectLine + 1
].
"is the initial acharacter within a word ?"
(wordCheck value:thisCharacter) ifTrue:[
- "
- try to catch a blank ...
- "
-
- WordSelectCatchesBlanks ifTrue:[
- ((beginCol == 1)
- or:[(self characterAtLine:selectLine col:(beginCol - 1))
- ~~ Character space]) ifTrue:[
- ((self characterAtLine:selectLine col:(endCol + 1))
- == Character space) ifTrue:[
- endCol := endCol + 1.
- flag := #wordRight
- ]
- ] ifFalse:[
- beginCol := beginCol - 1.
- flag := #wordLeft
- ].
- ].
+ "
+ try to catch a blank ...
+ "
+
+ WordSelectCatchesBlanks ifTrue:[
+ ((beginCol == 1)
+ or:[(self characterAtLine:selectLine col:(beginCol - 1))
+ ~~ Character space]) ifTrue:[
+ ((self characterAtLine:selectLine col:(endCol + 1))
+ == Character space) ifTrue:[
+ endCol := endCol + 1.
+ flag := #wordRight
+ ]
+ ] ifFalse:[
+ beginCol := beginCol - 1.
+ flag := #wordLeft
+ ].
+ ].
].
aFiveArgBlock value:selectLine
- value:beginCol
- value:endLine
- value:endCol
- value:flag
+ value:beginCol
+ value:endLine
+ value:endCol
+ value:flag
"Modified: 18.3.1996 / 17:31:04 / cg"
! !
@@ -605,9 +606,9 @@
selectionFgColor := color1 on:device.
selectionBgColor := color2 on:device.
shown ifTrue:[
- self hasSelection ifTrue:[
- self invalidate
- ]
+ self hasSelection ifTrue:[
+ self invalidate
+ ]
]
"Modified: 29.5.1996 / 16:22:15 / cg"
@@ -620,7 +621,7 @@
and selection. Added for ST-80 compatibility"
aspectSym notNil ifTrue:[aspectMsg := aspectSym.
- listMsg isNil ifTrue:[listMsg := aspectSym]].
+ listMsg isNil ifTrue:[listMsg := aspectSym]].
changeSym notNil ifTrue:[changeMsg := changeSym].
listSym notNil ifTrue:[listMsg := listSym].
menuSym notNil ifTrue:[menuMsg := menuSym].
@@ -652,45 +653,45 @@
"if moved outside of view, start autoscroll"
(y < 0) ifTrue:[
- self compressMotionEvents:false.
- self startAutoScrollUp:y.
- ^ self
+ self compressMotionEvents:false.
+ self startAutoScrollUp:y.
+ ^ self
].
(y > height) ifTrue:[
- self compressMotionEvents:false.
- self startAutoScrollDown:(y - height).
- ^ self
+ self compressMotionEvents:false.
+ self startAutoScrollDown:(y - height).
+ ^ self
].
((x < 0) and:[leftOffset ~~ 0]) ifTrue:[
- self compressMotionEvents:false.
- self startAutoScrollLeft:x.
- ^ self
+ self compressMotionEvents:false.
+ self startAutoScrollLeft:x.
+ ^ self
].
(x > width) ifTrue:[
- self compressMotionEvents:false.
- self startAutoScrollRight:(x - width).
- ^ self
+ self compressMotionEvents:false.
+ self startAutoScrollRight:(x - width).
+ ^ self
].
"move inside - stop autoscroll if any"
autoScrollBlock notNil ifTrue:[
- self stopScrollSelect
+ self stopScrollSelect
].
movedVisibleLine := self visibleLineOfY:y.
movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
(x < leftMargin) ifTrue:[
- movedCol := 0
+ movedCol := 0
] ifFalse:[
- movedCol := self colOfX:x inVisibleLine:movedVisibleLine
+ movedCol := self colOfX:x inVisibleLine:movedVisibleLine
].
((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[^ self].
selectionStartLine isNil ifTrue:[
- selectionStartLine := clickLine.
- selectionStartCol := clickCol.
- selectionEndLine := selectionStartLine.
- selectionEndCol := selectionStartCol
+ selectionStartLine := clickLine.
+ selectionStartCol := clickCol.
+ selectionEndLine := selectionStartLine.
+ selectionEndCol := selectionStartCol
].
oldStartLine := selectionStartLine.
oldEndLine := selectionEndLine.
@@ -701,88 +702,88 @@
"find out if we are before or after initial click"
movedUp := false.
(movedLine < clickStartLine) ifTrue:[
- movedUp := true
+ movedUp := true
] ifFalse:[
- (movedLine == clickStartLine) ifTrue:[
- (movedCol < clickStartCol) ifTrue:[
- movedUp := true
- ]
- ]
+ (movedLine == clickStartLine) ifTrue:[
+ (movedCol < clickStartCol) ifTrue:[
+ movedUp := true
+ ]
+ ]
].
movedUp ifTrue:[
- "change selectionStart"
- selectionStartCol := movedCol.
- selectionStartLine := movedLine.
- selectionEndCol := clickStartCol.
- selectionEndLine := clickStartLine.
- selectStyle notNil ifTrue:[
- selectionEndCol := wordEndCol.
- selectionEndLine := wordEndLine.
- ]
+ "change selectionStart"
+ selectionStartCol := movedCol.
+ selectionStartLine := movedLine.
+ selectionEndCol := clickStartCol.
+ selectionEndLine := clickStartLine.
+ selectStyle notNil ifTrue:[
+ selectionEndCol := wordEndCol.
+ selectionEndLine := wordEndLine.
+ ]
] ifFalse:[
- "change selectionEnd"
- selectionEndCol := movedCol.
- selectionEndLine := movedLine.
- selectionStartCol := clickStartCol.
- selectionStartLine := clickStartLine.
- selectStyle notNil ifTrue:[
- selectionStartCol := wordStartCol.
- selectionStartLine := wordStartLine.
- ]
+ "change selectionEnd"
+ selectionEndCol := movedCol.
+ selectionEndLine := movedLine.
+ selectionStartCol := clickStartCol.
+ selectionStartLine := clickStartLine.
+ selectStyle notNil ifTrue:[
+ selectionStartCol := wordStartCol.
+ selectionStartLine := wordStartLine.
+ ]
].
selectionStartLine isNil ifTrue:[^ self].
(selectionStartCol == 0) ifTrue:[
- selectionStartCol := 1
+ selectionStartCol := 1
].
"
if in word-select, just catch the rest of the word
"
(selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
- movedUp ifTrue:[
- selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
- ] ifFalse:[
- selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
- selectionEndCol == 0 ifTrue:[
- selectionEndLine := selectionEndLine + 1
- ]
- ].
+ movedUp ifTrue:[
+ selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
+ ] ifFalse:[
+ selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
+ selectionEndCol == 0 ifTrue:[
+ selectionEndLine := selectionEndLine + 1
+ ]
+ ].
].
selectStyle == #line ifTrue:[
- movedUp ifTrue:[
- selectionStartCol := 1.
- ] ifFalse:[
- selectionEndCol := 0.
- selectionEndLine := selectionEndLine + 1
- ]
+ movedUp ifTrue:[
+ selectionStartCol := 1.
+ ] ifFalse:[
+ selectionEndCol := 0.
+ selectionEndLine := selectionEndLine + 1
+ ]
].
self validateNewSelection.
(oldStartLine == selectionStartLine) ifTrue:[
- (oldStartCol ~~ selectionStartCol) ifTrue:[
- self redrawLine:oldStartLine
- from:((selectionStartCol min:oldStartCol) max:1)
- to:((selectionStartCol max:oldStartCol) max:1)
- ]
+ (oldStartCol ~~ selectionStartCol) ifTrue:[
+ self redrawLine:oldStartLine
+ from:((selectionStartCol min:oldStartCol) max:1)
+ to:((selectionStartCol max:oldStartCol) max:1)
+ ]
] ifFalse:[
- self redrawFromLine:(oldStartLine min:selectionStartLine)
- to:(oldStartLine max:selectionStartLine)
+ self redrawFromLine:(oldStartLine min:selectionStartLine)
+ to:(oldStartLine max:selectionStartLine)
].
(oldEndLine == selectionEndLine) ifTrue:[
- (oldEndCol ~~ selectionEndCol) ifTrue:[
- self redrawLine:oldEndLine
- from:((selectionEndCol min:oldEndCol) max:1)
- to:((selectionEndCol max:oldEndCol) max:1)
- ]
+ (oldEndCol ~~ selectionEndCol) ifTrue:[
+ self redrawLine:oldEndLine
+ from:((selectionEndCol min:oldEndCol) max:1)
+ to:((selectionEndCol max:oldEndCol) max:1)
+ ]
] ifFalse:[
- self redrawFromLine:(oldEndLine min:selectionEndLine)
- to:(oldEndLine max:selectionEndLine)
+ self redrawFromLine:(oldEndLine min:selectionEndLine)
+ to:(oldEndLine max:selectionEndLine)
].
clickLine := movedLine.
clickCol := movedCol
@@ -794,22 +795,22 @@
"multi-mouse-click - select word under pointer"
((button == 1) or:[button == #select]) ifTrue:[
- clickCount notNil ifTrue:[
- clickCount := clickCount + 1.
- (clickCount == 2) ifTrue:[
- self doubleClickX:x y:y
- ] ifFalse:[
- (clickCount == 3) ifTrue:[
- self tripleClickX:x y:y
- ] ifFalse:[
- (clickCount == 4) ifTrue:[
- self quadClickX:x y:y
- ]
- ]
- ]
- ]
+ clickCount notNil ifTrue:[
+ clickCount := clickCount + 1.
+ (clickCount == 2) ifTrue:[
+ self doubleClickX:x y:y
+ ] ifFalse:[
+ (clickCount == 3) ifTrue:[
+ self tripleClickX:x y:y
+ ] ifFalse:[
+ (clickCount == 4) ifTrue:[
+ self quadClickX:x y:y
+ ]
+ ]
+ ]
+ ]
] ifFalse:[
- super buttonMultiPress:button x:x y:y
+ super buttonMultiPress:button x:x y:y
]
"Modified: 11.9.1997 / 04:15:35 / cg"
@@ -822,22 +823,22 @@
sensor := self sensor.
(sensor notNil and:[ sensor shiftDown]) ifTrue:[
- "mouse-click with shift - adding to selection"
-
- "very simple - just simulate a move"
- ^ self buttonMotion:(device button1MotionMask) x:x y:y
+ "mouse-click with shift - adding to selection"
+
+ "very simple - just simulate a move"
+ ^ self buttonMotion:(device button1MotionMask) x:x y:y
].
((button == 1) or:[button == #select]) ifTrue:[
- clickVisibleLine := self visibleLineOfY:y.
- clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
- clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
- clickStartLine := clickLine.
- clickStartCol := clickCol.
- self unselect.
- clickCount := 1
+ clickVisibleLine := self visibleLineOfY:y.
+ clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
+ clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
+ clickStartLine := clickLine.
+ clickStartCol := clickCol.
+ self unselect.
+ clickCount := 1
] ifFalse:[
- super buttonPress:button x:x y:y
+ super buttonPress:button x:x y:y
]
"Modified: 19.8.1997 / 17:01:15 / cg"
@@ -861,78 +862,78 @@
|sel ch matchCol scanCol fwdScan|
ST80Selections == true ifTrue:[
- "/ st80 selects:
- "/ if clicked right after a parenthesis -> select to matching parenthesis
- "/ if clicked at beginning of the line -> select that line
- "/ if clicked at the top of the text -> select all
- "/
- clickCol == 1 ifTrue:[
- clickLine == 1 ifTrue:[
- self selectAll.
- ^ self.
- ].
- self selectLineAtY:y.
- selectStyle := #line.
- ^ self
- ].
-
- matchCol := nil.
- "/ see what is to the left of that character ...
- clickCol > 1 ifTrue:[
- ch := self characterAtLine:clickLine col:clickCol-1.
- ('([{<' includes:ch) ifTrue:[
- matchCol := clickCol - 1
- ] ifFalse:[
- ('"' includes:ch) ifTrue:[
- scanCol := clickCol - 1.
- fwdScan := true
- ]
- ]
- ].
- clickCol < (self listAt:clickLine) size ifTrue:[
- ch := self characterAtLine:clickLine col:clickCol+1.
- (')]}>' includes:ch) ifTrue:[
- matchCol := clickCol + 1.
- ] ifFalse:[
- ('"' includes:ch) ifTrue:[
- scanCol := clickCol + 1.
- fwdScan := false
- ]
- ]
- ].
- matchCol notNil ifTrue:[
- self searchForMatchingParenthesisFromLine:clickLine col:matchCol
- ifFound:[:line :col |
- self selectFromLine:clickLine col:matchCol
- toLine:line col:col.
- ^ self
- ]
- ifNotFound:[self showNotFound]
- onError:[self beep].
- ^ self
- ].
- scanCol notNil ifTrue:[
- "/ if its an EOL comment, do it differently
- ch := self characterAtLine:clickLine col:clickCol.
- ch == $/ ifTrue:[
- self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
- ^ self
- ].
-
- self scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
- ifFound:[:line :col |
- fwdScan ifTrue:[
- self selectFromLine:clickLine col:scanCol+1
- toLine:line col:col-1.
- ] ifFalse:[
- self selectFromLine:clickLine col:scanCol-1
- toLine:line col:col+1.
- ].
- ^ self
- ]
- ifNotFound:[self showNotFound].
- ^ self
- ]
+ "/ st80 selects:
+ "/ if clicked right after a parenthesis -> select to matching parenthesis
+ "/ if clicked at beginning of the line -> select that line
+ "/ if clicked at the top of the text -> select all
+ "/
+ clickCol == 1 ifTrue:[
+ clickLine == 1 ifTrue:[
+ self selectAll.
+ ^ self.
+ ].
+ self selectLineAtY:y.
+ selectStyle := #line.
+ ^ self
+ ].
+
+ matchCol := nil.
+ "/ see what is to the left of that character ...
+ clickCol > 1 ifTrue:[
+ ch := self characterAtLine:clickLine col:clickCol-1.
+ ('([{<' includes:ch) ifTrue:[
+ matchCol := clickCol - 1
+ ] ifFalse:[
+ ('"' includes:ch) ifTrue:[
+ scanCol := clickCol - 1.
+ fwdScan := true
+ ]
+ ]
+ ].
+ clickCol < (self listAt:clickLine) size ifTrue:[
+ ch := self characterAtLine:clickLine col:clickCol+1.
+ (')]}>' includes:ch) ifTrue:[
+ matchCol := clickCol + 1.
+ ] ifFalse:[
+ ('"' includes:ch) ifTrue:[
+ scanCol := clickCol + 1.
+ fwdScan := false
+ ]
+ ]
+ ].
+ matchCol notNil ifTrue:[
+ self searchForMatchingParenthesisFromLine:clickLine col:matchCol
+ ifFound:[:line :col |
+ self selectFromLine:clickLine col:matchCol
+ toLine:line col:col.
+ ^ self
+ ]
+ ifNotFound:[self showNotFound]
+ onError:[self beep].
+ ^ self
+ ].
+ scanCol notNil ifTrue:[
+ "/ if its an EOL comment, do it differently
+ ch := self characterAtLine:clickLine col:clickCol.
+ ch == $/ ifTrue:[
+ self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
+ ^ self
+ ].
+
+ self scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
+ ifFound:[:line :col |
+ fwdScan ifTrue:[
+ self selectFromLine:clickLine col:scanCol+1
+ toLine:line col:col-1.
+ ] ifFalse:[
+ self selectFromLine:clickLine col:scanCol-1
+ toLine:line col:col+1.
+ ].
+ ^ self
+ ]
+ ifNotFound:[self showNotFound].
+ ^ self
+ ]
].
self selectWordAtX:x y:y.
@@ -942,48 +943,48 @@
"
((sel := self selection) size == 1
and:[(sel := sel at:1) size == 1]) ifTrue:[
- ch := sel at:1.
- ('()[]{}<>' includes:ch) ifTrue:[
- self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
- ifFound:[:line :col |
- |prevLine prevCol moveBack pos1|
-
- prevLine := firstLineShown.
- prevCol := leftOffset.
- self selectFromLine:selectionStartLine col:selectionStartCol
- toLine:line col:col.
-
- self sensor ctrlDown ifFalse:[
- "/ undo scroll operation ...
- self withCursor:Cursor eye do:[
- moveBack := false.
- (')]}>' includes:ch) ifTrue:[
- (firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[
- moveBack := true
- ]
- ] ifFalse:[
- selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
- self makeLineVisible:selectionEndLine.
- moveBack := true
- ]
- ].
- moveBack ifTrue:[
- pos1 := x@y.
- self invalidateRepairNow:true.
- Delay waitForSeconds:MatchDelayTime.
+ ch := sel at:1.
+ ('()[]{}<>' includes:ch) ifTrue:[
+ self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
+ ifFound:[:line :col |
+ |prevLine prevCol moveBack pos1|
+
+ prevLine := firstLineShown.
+ prevCol := leftOffset.
+ self selectFromLine:selectionStartLine col:selectionStartCol
+ toLine:line col:col.
+
+ self sensor ctrlDown ifFalse:[
+ "/ undo scroll operation ...
+ self withCursor:Cursor eye do:[
+ moveBack := false.
+ (')]}>' includes:ch) ifTrue:[
+ (firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[
+ moveBack := true
+ ]
+ ] ifFalse:[
+ selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
+ self makeLineVisible:selectionEndLine.
+ moveBack := true
+ ]
+ ].
+ moveBack ifTrue:[
+ pos1 := x@y.
+ self invalidateRepairNow:true.
+ Delay waitForSeconds:MatchDelayTime.
- [self sensor hasUserEventFor:self] whileFalse:[
- Delay waitForSeconds:MatchDelayTime / 2.
- ].
- self scrollToLine:prevLine; scrollToCol:prevCol.
- ].
- ]
- ]
- ]
- ifNotFound:[self showNotFound]
- onError:[self beep].
- selectStyle := nil
- ]
+ [self sensor hasUserEventFor:self] whileFalse:[
+ Delay waitForSeconds:MatchDelayTime / 2.
+ ].
+ self scrollToLine:prevLine; scrollToCol:prevCol.
+ ].
+ ]
+ ]
+ ]
+ ifNotFound:[self showNotFound]
+ onError:[self beep].
+ selectStyle := nil
+ ]
].
"
@@ -992,14 +993,14 @@
wordStartLine := selectionStartLine.
wordEndLine := selectionEndLine.
selectStyle == #wordLeft ifTrue:[
- wordStartCol := selectionStartCol + 1
+ wordStartCol := selectionStartCol + 1
] ifFalse:[
- wordStartCol := selectionStartCol.
+ wordStartCol := selectionStartCol.
].
selectStyle == #wordRight ifTrue:[
- wordEndCol := selectionEndCol - 1
+ wordEndCol := selectionEndCol - 1
] ifFalse:[
- wordEndCol := selectionEndCol
+ wordEndCol := selectionEndCol
]
"Created: 11.9.1997 / 04:12:55 / cg"
@@ -1010,8 +1011,8 @@
"handle some keyboard input (there is not much to be done here)"
<resource: #keyboard (#Find #Copy #FindNext #FindPrev
- #GotoLine #SelectAll #SaveAs #Print
- #'F*' #'f*' )>
+ #GotoLine #SelectAll #SaveAs #Print
+ #'F*' #'f*' )>
(key == #Find) ifTrue:[self search. ^self].
(key == #Copy) ifTrue:[self copySelection. ^self].
@@ -1033,16 +1034,16 @@
(see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
"
(key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
- (('[fF][0-9]' match:key)
- or:['[fF][0-9][0-9]' match:key]) ifTrue:[
- self sensor shiftDown ifTrue:[
- (Smalltalk at:#FunctionKeySequences) isNil ifTrue:[
- Smalltalk at:#FunctionKeySequences put:Dictionary new
- ].
- (Smalltalk at:#FunctionKeySequences) at:key put:(self selection)
- ].
- ^ self
- ].
+ (('[fF][0-9]' match:key)
+ or:['[fF][0-9][0-9]' match:key]) ifTrue:[
+ self sensor shiftDown ifTrue:[
+ (Smalltalk at:#FunctionKeySequences) isNil ifTrue:[
+ Smalltalk at:#FunctionKeySequences put:Dictionary new
+ ].
+ (Smalltalk at:#FunctionKeySequences) at:key put:(self selection)
+ ].
+ ^ self
+ ].
].
super keyPress:key x:x y:y
@@ -1100,21 +1101,21 @@
selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
selectionBgColor := DefaultSelectionBackgroundColor.
selectionBgColor isNil ifTrue:[
- device hasColors ifTrue:[
- DefaultSelectionForegroundColor isNil ifTrue:[
- selectionFgColor := fgColor
- ].
- selectionBgColor := Color green
- ] ifFalse:[
- device hasGrayscales ifTrue:[
- DefaultSelectionForegroundColor isNil ifTrue:[
- selectionFgColor := fgColor
- ].
- selectionBgColor := Color grey
- ] ifFalse:[
- selectionBgColor := fgColor
- ]
- ]
+ device hasColors ifTrue:[
+ DefaultSelectionForegroundColor isNil ifTrue:[
+ selectionFgColor := fgColor
+ ].
+ selectionBgColor := Color green
+ ] ifFalse:[
+ device hasGrayscales ifTrue:[
+ DefaultSelectionForegroundColor isNil ifTrue:[
+ selectionFgColor := fgColor
+ ].
+ selectionBgColor := Color grey
+ ] ifFalse:[
+ selectionBgColor := fgColor
+ ]
+ ]
].
"Modified: 22.1.1997 / 11:57:53 / cg"
@@ -1158,7 +1159,7 @@
newFont := FontPanel fontFromUserInitial:font.
newFont notNil ifTrue:[
- self font:newFont.
+ self font:newFont.
]
"Modified: 27.2.1996 / 00:53:51 / cg"
@@ -1171,11 +1172,11 @@
text := self selection.
text notNil ifTrue:[
- self unselect.
+ self unselect.
"/ forget any emphasis ...
- text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
- self setTextSelection:text.
+ text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
+ self setTextSelection:text.
]
"Modified: 17.5.1996 / 08:57:54 / cg"
@@ -1197,17 +1198,17 @@
list isNil ifTrue:[^ self].
self withWaitCursorDo:[
- printStream := Printer new.
- printStream notNil ifTrue:[
- Printer writeErrorSignal handle:[:ex |
- self warn:('error while printing:\\'
- , ex errorString
- , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
- ] do:[
- self fileOutContentsOn:printStream.
- ].
- printStream close
- ]
+ printStream := Printer new.
+ printStream notNil ifTrue:[
+ Printer writeErrorSignal handle:[:ex |
+ self warn:('error while printing:\\'
+ , ex errorString
+ , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
+ ] do:[
+ self fileOutContentsOn:printStream.
+ ].
+ printStream close
+ ]
].
"Created: 6.5.1996 / 16:11:26 / cg"
@@ -1223,21 +1224,21 @@
|items m|
items := #(
- ('copy' copySelection Copy)
- ('-' nil )
- ('font ...' changeFont )
- ('-' nil )
- ('search ...' search Find)
- ('goto ...' gotoLine GotoLine)
- ('-' nil )
- ('save as ...' save SaveAs)
- ('print' doPrint Print)
- ).
+ ('copy' copySelection Copy)
+ ('-' nil )
+ ('font ...' changeFont )
+ ('-' nil )
+ ('search ...' search Find)
+ ('goto ...' gotoLine GotoLine)
+ ('-' nil )
+ ('save as ...' save SaveAs)
+ ('print' doPrint Print)
+ ).
m := PopUpMenu itemList:items resources:resources.
self hasSelection ifFalse:[
- m disable:#copySelection.
+ m disable:#copySelection.
].
^ m
@@ -1260,44 +1261,44 @@
|l lineNumberBox input lineToGo fwd bwd|
lineNumberBox :=
- EnterBox
- title:(resources string:'line number:')
- okText:(resources string:'goto')
- abortText:(resources string:'cancel')
- action:[:l | input := l].
+ EnterBox
+ title:(resources string:'line number:')
+ okText:(resources string:'goto')
+ abortText:(resources string:'cancel')
+ action:[:l | input := l].
l := self defaultForGotoLine.
l notNil ifTrue:[
- l := l printString
+ l := l printString
].
lineNumberBox initialText:l .
lineNumberBox showAtPointer.
input size > 0 ifTrue:[
- input := input withoutSpaces.
- input size > 0 ifTrue:[
- fwd := bwd := false.
- (input startsWith:$+) ifTrue:[
- input := input copyFrom:2.
- fwd := true.
- ] ifFalse:[
- (input startsWith:$-) ifTrue:[
- input := input copyFrom:2.
- bwd := true.
- ].
- ].
- lineToGo := Integer readFromString:input onError:nil.
- lineToGo notNil ifTrue:[
- fwd ifTrue:[
- lineToGo := self currentLine + lineToGo
- ] ifFalse:[
- bwd ifTrue:[
- lineToGo := self currentLine - lineToGo
- ]
- ].
- self gotoLine:lineToGo
- ]
- ]
+ input := input withoutSpaces.
+ input size > 0 ifTrue:[
+ fwd := bwd := false.
+ (input startsWith:$+) ifTrue:[
+ input := input copyFrom:2.
+ fwd := true.
+ ] ifFalse:[
+ (input startsWith:$-) ifTrue:[
+ input := input copyFrom:2.
+ bwd := true.
+ ].
+ ].
+ lineToGo := Integer readFromString:input onError:nil.
+ lineToGo notNil ifTrue:[
+ fwd ifTrue:[
+ lineToGo := self currentLine + lineToGo
+ ] ifFalse:[
+ bwd ifTrue:[
+ lineToGo := self currentLine - lineToGo
+ ]
+ ].
+ self gotoLine:lineToGo
+ ]
+ ]
].
"Modified: / 17.5.1998 / 20:07:59 / cg"
@@ -1310,16 +1311,16 @@
|fileBox|
fileBox := FileSaveBox
- title:(resources string:'save contents in:')
- okText:(resources string:'save')
- abortText:(resources string:'cancel')
- action:[:fileName | self saveAs:fileName].
+ title:(resources string:'save contents in:')
+ okText:(resources string:'save')
+ abortText:(resources string:'cancel')
+ action:[:fileName | self saveAs:fileName].
fileBox appendAction:[:fileName | self appendTo:fileName].
directoryForFileDialog notNil ifTrue:[
- fileBox directory:directoryForFileDialog
+ fileBox directory:directoryForFileDialog
].
defaultFileNameForFileDialog notNil ifTrue:[
- fileBox initialText:defaultFileNameForFileDialog asString
+ fileBox initialText:defaultFileNameForFileDialog asString
].
fileBox showAtPointer.
@@ -1334,22 +1335,22 @@
"save the contents into a file named fileName"
self withCursor:Cursor write do:[
- |aStream msg|
-
- FileStream openErrorSignal catch:[
- aStream := FileStream newFileNamed:fileName.
- ].
- aStream isNil ifTrue:[
- msg := resources string:'cannot write file ''%1'' !!' with:fileName.
- self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
- ] ifFalse:[
- self
- fileOutContentsOn:aStream
- compressTabs:true
- encoding:externalEncoding.
- aStream close.
- contentsWasSaved := true
- ]
+ |aStream msg|
+
+ FileStream openErrorSignal catch:[
+ aStream := FileStream newFileNamed:fileName.
+ ].
+ aStream isNil ifTrue:[
+ msg := resources string:'cannot write file ''%1'' !!' with:fileName.
+ self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
+ ] ifFalse:[
+ self
+ fileOutContentsOn:aStream
+ compressTabs:true
+ encoding:externalEncoding.
+ aStream close.
+ contentsWasSaved := true
+ ]
]
"Modified: 22.10.1997 / 12:32:51 / cg"
@@ -1397,40 +1398,40 @@
"/ searchBox addButton:(Button label:(resources at:'all'));
lastSearchPattern notNil ifTrue:[
- stringHolder value:lastSearchPattern
+ stringHolder value:lastSearchPattern
].
self hasSelection ifTrue:[
- selectionStartLine == selectionEndLine ifTrue:[
- stringHolder value:self selection
- ]
+ selectionStartLine == selectionEndLine ifTrue:[
+ stringHolder value:self selection
+ ]
].
patternField selectAll.
searchBox open.
searchBox accepted ifTrue:[
- pattern := stringHolder value.
- pattern := pattern string withoutSeparators. "/ is that a good idea ?
- pattern notEmpty ifTrue:[
- LastSearchPatterns isNil ifTrue:[
- LastSearchPatterns := OrderedCollection new.
- ].
- (LastSearchPatterns includes:pattern) ifTrue:[
- LastSearchPatterns remove:pattern.
- ] ifFalse:[
- LastSearchPatterns size > 10 ifTrue:[
- LastSearchPatterns removeFirst
- ]
- ].
- LastSearchPatterns addFirst:pattern.
-
- ign := caseHolder value.
- fwd ifFalse:[
- self searchBwd:pattern ignoreCase:ign.
- ] ifTrue:[
- self searchFwd:pattern ignoreCase:ign.
- ]
- ]
+ pattern := stringHolder value.
+ pattern := pattern string withoutSeparators. "/ is that a good idea ?
+ pattern notEmpty ifTrue:[
+ LastSearchPatterns isNil ifTrue:[
+ LastSearchPatterns := OrderedCollection new.
+ ].
+ (LastSearchPatterns includes:pattern) ifTrue:[
+ LastSearchPatterns remove:pattern.
+ ] ifFalse:[
+ LastSearchPatterns size > 10 ifTrue:[
+ LastSearchPatterns removeFirst
+ ]
+ ].
+ LastSearchPatterns addFirst:pattern.
+
+ ign := caseHolder value.
+ fwd ifFalse:[
+ self searchBwd:pattern ignoreCase:ign.
+ ] ifTrue:[
+ self searchFwd:pattern ignoreCase:ign.
+ ]
+ ]
].
"/ searchBox :=
@@ -1482,33 +1483,33 @@
|startNr nLines string|
aStream isFileStream ifTrue:[
- "on some systems, writing linewise is very slow (via NFS)
- therefore we convert to a string and write it in big chunks.
- To avoid creating huge strings, we do it in blocks of 1000 lines,
- limiting temporary string creation to about 50-80k.
- "
- startNr := 1.
- nLines := list size.
- [startNr <= nLines] whileTrue:[
- string := list asStringWithCRsFrom:startNr
- to:((startNr + 1000) min:nLines)
- compressTabs:compressTabs.
+ "on some systems, writing linewise is very slow (via NFS)
+ therefore we convert to a string and write it in big chunks.
+ To avoid creating huge strings, we do it in blocks of 1000 lines,
+ limiting temporary string creation to about 50-80k.
+ "
+ startNr := 1.
+ nLines := list size.
+ [startNr <= nLines] whileTrue:[
+ string := list asStringWithCRsFrom:startNr
+ to:((startNr + 1000) min:nLines)
+ compressTabs:compressTabs.
encodingSymOrNil notNil ifTrue:[
string := string encodeInto:encodingSymOrNil
].
- aStream nextPutAll:string.
- startNr := startNr + 1000 + 1.
- ].
+ aStream nextPutAll:string.
+ startNr := startNr + 1000 + 1.
+ ].
] ifFalse:[
- list do:[:aLine |
- aLine notNil ifTrue:[
- encodingSymOrNil notNil ifTrue:[
+ list do:[:aLine |
+ aLine notNil ifTrue:[
+ encodingSymOrNil notNil ifTrue:[
aStream nextPutLine:(aLine encodeInto:encodingSymOrNil)
- ] ifFalse:[
- aStream nextPutLine:aLine.
- ]
- ].
- ]
+ ] ifFalse:[
+ aStream nextPutLine:aLine.
+ ]
+ ].
+ ]
]
"Modified: 8.6.1996 / 11:50:46 / cg"
@@ -1522,10 +1523,10 @@
font := font on:device.
includesNonStrings == true ifTrue:[
- "/ for now, we do not support variable height entries ...
- fontHeight := list first heightOn:self
+ "/ for now, we do not support variable height entries ...
+ fontHeight := list first heightOn:self
] ifFalse:[
- fontHeight := font maxHeight.
+ fontHeight := font maxHeight.
].
fontHeight := fontHeight + lineSpacing.
fontAscent := font maxAscent.
@@ -1649,11 +1650,11 @@
"if there is a margin, clear it - a helper for selection drawing"
(leftMargin ~~ 0) ifTrue:[
- self paint:color.
- self fillRectangleX:margin
- y:(self yOfVisibleLine:visLine)
- width:leftMargin
- height:fontHeight
+ self paint:color.
+ self fillRectangleX:margin
+ y:(self yOfVisibleLine:visLine)
+ width:leftMargin
+ height:fontHeight
]
"Created: 6.3.1996 / 14:22:55 / cg"
@@ -1760,62 +1761,62 @@
|len line l|
selectionStartLine notNil ifTrue:[
- line := self visibleLineToAbsoluteLine:visLine.
- (line between:selectionStartLine and:selectionEndLine) ifTrue:[
- (line == selectionStartLine) ifTrue:[
- (line == selectionEndLine) ifTrue:[
- "its part-of-single-line selection"
- self clearMarginOfVisibleLine:visLine with:bgColor.
- (selectionStartCol > 1) ifTrue:[
- super redrawVisibleLine:visLine
- from:1
- to:(selectionStartCol - 1)
- ].
- self drawVisibleLine:visLine from:selectionStartCol
- to:selectionEndCol
- with:selectionFgColor
- and:selectionBgColor.
- super redrawVisibleLine:visLine
- from:(selectionEndCol + 1).
- ^ self
- ].
-
- "its the first line of a multi-line selection"
- (selectionStartCol ~~ 1) ifTrue:[
- self clearMarginOfVisibleLine:visLine with:bgColor.
- super redrawVisibleLine:visLine
- from:1
- to:(selectionStartCol - 1)
- ] ifFalse:[
- leftOffset == 0 ifTrue:[
- self clearMarginOfVisibleLine:visLine with:selectionBgColor.
- ]
- ].
- self drawVisibleLine:visLine from:selectionStartCol
- with:selectionFgColor and:selectionBgColor.
- ^ self
- ].
-
- (line == selectionEndLine) ifTrue:[
- "its the last line of a multi-line selection"
- (selectionEndCol == 0) ifTrue:[
- ^ super redrawVisibleLine:visLine
- ].
- l := self visibleAt:selectionEndLine.
- len := l size.
-
- self clearMarginOfVisibleLine:visLine with:selectionBgColor.
- self drawVisibleLine:visLine from:1 to:selectionEndCol
- with:selectionFgColor and:selectionBgColor.
- super redrawVisibleLine:visLine from:(selectionEndCol + 1).
- ^ self
- ].
-
- "its a full line in a multi-line selection"
- self clearMarginOfVisibleLine:visLine with:selectionBgColor.
- self drawVisibleLine:visLine with:selectionFgColor and:selectionBgColor.
- ^ self
- ]
+ line := self visibleLineToAbsoluteLine:visLine.
+ (line between:selectionStartLine and:selectionEndLine) ifTrue:[
+ (line == selectionStartLine) ifTrue:[
+ (line == selectionEndLine) ifTrue:[
+ "its part-of-single-line selection"
+ self clearMarginOfVisibleLine:visLine with:bgColor.
+ (selectionStartCol > 1) ifTrue:[
+ super redrawVisibleLine:visLine
+ from:1
+ to:(selectionStartCol - 1)
+ ].
+ self drawVisibleLine:visLine from:selectionStartCol
+ to:selectionEndCol
+ with:selectionFgColor
+ and:selectionBgColor.
+ super redrawVisibleLine:visLine
+ from:(selectionEndCol + 1).
+ ^ self
+ ].
+
+ "its the first line of a multi-line selection"
+ (selectionStartCol ~~ 1) ifTrue:[
+ self clearMarginOfVisibleLine:visLine with:bgColor.
+ super redrawVisibleLine:visLine
+ from:1
+ to:(selectionStartCol - 1)
+ ] ifFalse:[
+ leftOffset == 0 ifTrue:[
+ self clearMarginOfVisibleLine:visLine with:selectionBgColor.
+ ]
+ ].
+ self drawVisibleLine:visLine from:selectionStartCol
+ with:selectionFgColor and:selectionBgColor.
+ ^ self
+ ].
+
+ (line == selectionEndLine) ifTrue:[
+ "its the last line of a multi-line selection"
+ (selectionEndCol == 0) ifTrue:[
+ ^ super redrawVisibleLine:visLine
+ ].
+ l := self visibleAt:selectionEndLine.
+ len := l size.
+
+ self clearMarginOfVisibleLine:visLine with:selectionBgColor.
+ self drawVisibleLine:visLine from:1 to:selectionEndCol
+ with:selectionFgColor and:selectionBgColor.
+ super redrawVisibleLine:visLine from:(selectionEndCol + 1).
+ ^ self
+ ].
+
+ "its a full line in a multi-line selection"
+ self clearMarginOfVisibleLine:visLine with:selectionBgColor.
+ self drawVisibleLine:visLine with:selectionFgColor and:selectionBgColor.
+ ^ self
+ ]
].
super redrawVisibleLine:visLine
@@ -1836,17 +1837,17 @@
bg := bgColor.
selectionStartLine notNil ifTrue:[
- (line between:selectionStartLine and:selectionEndLine) ifTrue:[
- ((line == selectionStartLine)
- and: [col < selectionStartCol]) ifFalse:[
- ((line == selectionEndLine)
- and: [col > selectionEndCol]) ifFalse:[
- "its in the selection"
- fg := selectionFgColor.
- bg := selectionBgColor.
- ]
- ]
- ]
+ (line between:selectionStartLine and:selectionEndLine) ifTrue:[
+ ((line == selectionStartLine)
+ and: [col < selectionStartCol]) ifFalse:[
+ ((line == selectionEndLine)
+ and: [col > selectionEndCol]) ifFalse:[
+ "its in the selection"
+ fg := selectionFgColor.
+ bg := selectionBgColor.
+ ]
+ ]
+ ]
].
self drawVisibleLine:visLine col:col with:fg and:bg
@@ -1860,26 +1861,26 @@
col := startCol.
col == 0 ifTrue:[
- col := 1.
+ col := 1.
].
line := self visibleLineToAbsoluteLine:visLine.
selectionStartLine notNil ifTrue:[
- (line between:selectionStartLine and:selectionEndLine) ifTrue:[
- ((line == selectionStartLine)
- or:[line == selectionEndLine]) ifTrue:[
- "since I'm lazy, redraw full line"
- self redrawVisibleLine:visLine.
- ^ self
- ].
- "the line is fully within the selection"
- self
- drawVisibleLine:visLine
- from:col
- with:selectionFgColor
- and:selectionBgColor.
- ^ self
- ]
+ (line between:selectionStartLine and:selectionEndLine) ifTrue:[
+ ((line == selectionStartLine)
+ or:[line == selectionEndLine]) ifTrue:[
+ "since I'm lazy, redraw full line"
+ self redrawVisibleLine:visLine.
+ ^ self
+ ].
+ "the line is fully within the selection"
+ self
+ drawVisibleLine:visLine
+ from:col
+ with:selectionFgColor
+ and:selectionBgColor.
+ ^ self
+ ]
].
super redrawVisibleLine:visLine from:col
@@ -1896,77 +1897,77 @@
allIn := false.
allOut := false.
selectionStartLine isNil ifTrue:[
- allOut := true
+ allOut := true
] ifFalse:[
- (line between:selectionStartLine and:selectionEndLine) ifFalse:[
- allOut := true
- ] ifTrue:[
- (selectionStartLine == selectionEndLine) ifTrue:[
- ((endCol < selectionStartCol)
- or:[startCol > selectionEndCol]) ifTrue:[
- allOut := true
- ] ifFalse:[
- ((startCol >= selectionStartCol)
- and:[endCol <= selectionEndCol]) ifTrue:[
- allIn := true
- ]
- ]
- ] ifFalse:[
- (line == selectionStartLine) ifTrue:[
- (endCol < selectionStartCol) ifTrue:[
- allOut := true
- ] ifFalse:[
- (startCol >= selectionStartCol) ifTrue:[
- allIn := true
- ]
- ]
- ] ifFalse:[
- (line == selectionEndLine) ifTrue:[
- (startCol > selectionEndCol) ifTrue:[
- allOut := true
- ] ifFalse:[
- (endCol <= selectionEndCol) ifTrue:[
- allIn := true
- ]
- ]
- ] ifFalse:[
- allIn := true
- ]
- ]
- ]
- ]
+ (line between:selectionStartLine and:selectionEndLine) ifFalse:[
+ allOut := true
+ ] ifTrue:[
+ (selectionStartLine == selectionEndLine) ifTrue:[
+ ((endCol < selectionStartCol)
+ or:[startCol > selectionEndCol]) ifTrue:[
+ allOut := true
+ ] ifFalse:[
+ ((startCol >= selectionStartCol)
+ and:[endCol <= selectionEndCol]) ifTrue:[
+ allIn := true
+ ]
+ ]
+ ] ifFalse:[
+ (line == selectionStartLine) ifTrue:[
+ (endCol < selectionStartCol) ifTrue:[
+ allOut := true
+ ] ifFalse:[
+ (startCol >= selectionStartCol) ifTrue:[
+ allIn := true
+ ]
+ ]
+ ] ifFalse:[
+ (line == selectionEndLine) ifTrue:[
+ (startCol > selectionEndCol) ifTrue:[
+ allOut := true
+ ] ifFalse:[
+ (endCol <= selectionEndCol) ifTrue:[
+ allIn := true
+ ]
+ ]
+ ] ifFalse:[
+ allIn := true
+ ]
+ ]
+ ]
+ ]
].
allOut ifTrue:[
- super redrawVisibleLine:visLine from:startCol to:endCol.
- ^ self
+ super redrawVisibleLine:visLine from:startCol to:endCol.
+ ^ self
].
allIn ifTrue:[
- self drawVisibleLine:visLine from:startCol to:endCol
- with:selectionFgColor and:selectionBgColor
+ self drawVisibleLine:visLine from:startCol to:endCol
+ with:selectionFgColor and:selectionBgColor
] ifFalse:[
- "redraw part before selection"
- ((line == selectionStartLine)
- and:[startCol <= selectionStartCol]) ifTrue:[
- super redrawVisibleLine:visLine from:startCol
- to:(selectionStartCol - 1).
- leftCol := selectionStartCol
- ] ifFalse:[
- leftCol := startCol
- ].
- "redraw selected part"
- (selectionEndLine > line) ifTrue:[
- rightCol := endCol
- ] ifFalse:[
- rightCol := selectionEndCol min:endCol
- ].
- self drawVisibleLine:visLine from:leftCol to:rightCol
- with:selectionFgColor and:selectionBgColor.
-
- "redraw part after selection"
- (rightCol < endCol) ifTrue:[
- super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
- ]
+ "redraw part before selection"
+ ((line == selectionStartLine)
+ and:[startCol <= selectionStartCol]) ifTrue:[
+ super redrawVisibleLine:visLine from:startCol
+ to:(selectionStartCol - 1).
+ leftCol := selectionStartCol
+ ] ifFalse:[
+ leftCol := startCol
+ ].
+ "redraw selected part"
+ (selectionEndLine > line) ifTrue:[
+ rightCol := endCol
+ ] ifFalse:[
+ rightCol := selectionEndCol min:endCol
+ ].
+ self drawVisibleLine:visLine from:leftCol to:rightCol
+ with:selectionFgColor and:selectionBgColor.
+
+ "redraw part after selection"
+ (rightCol < endCol) ifTrue:[
+ super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
+ ]
].
"special care for first and last line of selection:
@@ -1976,14 +1977,14 @@
and:[(startCol == 1)
and:[selectionStartLine < selectionEndLine]])
ifTrue:[
- self clearMarginOfVisibleLine:visLine with:selectionBgColor.
+ self clearMarginOfVisibleLine:visLine with:selectionBgColor.
].
((line == selectionStartLine)
and:[(startCol == 1)
and:[selectionStartLine < selectionEndLine]])
ifTrue:[
- self clearMarginOfVisibleLine:visLine with:bgColor.
+ self clearMarginOfVisibleLine:visLine with:bgColor.
]
"Modified: 6.3.1996 / 14:23:26 / cg"
@@ -1992,8 +1993,8 @@
!TextView methodsFor:'searching'!
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
- ifFound:foundBlock
- ifNotFound:notFoundBlock
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
"search for a character in the direction given by forward.
Performs foundBlock with line/col as argument if found, notFoundBlock if not."
@@ -2009,9 +2010,9 @@
col := startCol.
line := startLine.
forward ifTrue:[
- delta := 1.
+ delta := 1.
] ifFalse:[
- delta := -1.
+ delta := -1.
].
lineString := list at:line.
@@ -2019,30 +2020,30 @@
col := col + delta.
[true] whileTrue:[
- lineString notNil ifTrue:[
- forward ifTrue:[
- endCol := lineString size.
- ] ifFalse:[
- endCol := 1
- ].
-
- col to:endCol by:delta do:[:rCol |
- cc := lineString at:rCol.
- cc == aCharacter ifTrue:[
- ^ foundBlock value:line value:rCol.
- ]
- ].
- ].
- line := line + delta.
- (line < 1 or:[line > maxLine]) ifTrue:[
- ^ notFoundBlock value
- ].
- lineString := list at:line.
- forward ifTrue:[
- col := 1
- ] ifFalse:[
- col := lineString size
- ]
+ lineString notNil ifTrue:[
+ forward ifTrue:[
+ endCol := lineString size.
+ ] ifFalse:[
+ endCol := 1
+ ].
+
+ col to:endCol by:delta do:[:rCol |
+ cc := lineString at:rCol.
+ cc == aCharacter ifTrue:[
+ ^ foundBlock value:line value:rCol.
+ ]
+ ].
+ ].
+ line := line + delta.
+ (line < 1 or:[line > maxLine]) ifTrue:[
+ ^ notFoundBlock value
+ ].
+ lineString := list at:line.
+ forward ifTrue:[
+ col := 1
+ ] ifFalse:[
+ col := lineString size
+ ]
].
"not reached"
@@ -2059,7 +2060,7 @@
self setSearchPattern.
lastSearchPattern notNil ifTrue:[
- self
+ self
searchBwd:lastSearchPattern
ignoreCase:ign
]
@@ -2083,16 +2084,16 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
self
- searchBackwardFor:pattern startingAtLine:startLine col:startCol
- ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
- ifAbsent:aBlock
+ searchBackwardFor:pattern startingAtLine:startLine col:startCol
+ ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:49 / cg"
!
@@ -2114,27 +2115,27 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
self
- searchBackwardFor:pattern
- ignoreCase:ign
- startingAtLine:startLine col:startCol
- ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
- ifAbsent:aBlock
+ searchBackwardFor:pattern
+ ignoreCase:ign
+ startingAtLine:startLine col:startCol
+ ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:49 / cg"
"Created: 13.9.1997 / 06:18:41 / cg"
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
"search for a matching parenthesis, parChar is one of '$( $[ ${ $) $] $}'.
Search for the corresponding character is done forward if its an opening,
@@ -2143,20 +2144,20 @@
If there is a nesting error, performs failBlock."
^ self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- ignoring:#( $' $" '$[' '$]' '${' '$)' )
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ ignoring:#( $' $" '$[' '$]' '${' '$)' )
"Modified: 18.5.1996 / 11:05:57 / cg"
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- ignoring:ignoreSet
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ ignoring:ignoreSet
"search for a matching parenthesis, parChar is one of '$( $[ ${ $) $] $}'.
Search for the corresponding character is done forward if its an opening,
backwards if its a closing parenthesis.
@@ -2181,7 +2182,7 @@
parChar := self characterAtLine:startLine col:startCol.
i := charSet indexOf:parChar.
i == 0 ifTrue:[
- ^ failBlock value "not a parenthesis"
+ ^ failBlock value "not a parenthesis"
].
direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
@@ -2189,13 +2190,13 @@
col := startCol.
line := startLine.
direction == #fwd ifTrue:[
- delta := 1.
- incSet := #( $( $[ ${ "$<" ).
- decSet := #( $) $] $} "$>" ).
+ delta := 1.
+ incSet := #( $( $[ ${ "$<" ).
+ decSet := #( $) $] $} "$>" ).
] ifFalse:[
- delta := -1.
- incSet := #( $) $] $} "$>" ).
- decSet := #( $( $[ ${ "$<" ).
+ delta := -1.
+ incSet := #( $) $] $} "$>" ).
+ decSet := #( $( $[ ${ "$<" ).
].
anySet := Set new.
anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
@@ -2208,99 +2209,99 @@
col := col + delta.
[nesting ~~ 0] whileTrue:[
- (lineString notNil
- and:[lineString includesAny:anySet]) ifTrue:[
- direction == #fwd ifTrue:[
- endCol := lineString size.
- ] ifFalse:[
- endCol := 1
- ].
-
- col to:endCol by:delta do:[:rCol |
- runCol := rCol.
-
- cc := lineString at:runCol.
- runCol < lineString size ifTrue:[
- nextCC := lineString at:runCol+1
- ] ifFalse:[
- nextCC := nil
- ].
- runCol > 1 ifTrue:[
- prevCC := lineString at:runCol-1
- ] ifFalse:[
- prevCC := nil
- ].
-
- ign := skip := false.
- (cc == $"
- and:[nextCC == $/ or:[prevCC == $$ ]]) ifTrue:[
- "/ do nothing
-
- skip := true.
- ] ifFalse:[
- ignoreSet do:[:ignore |
- ignore == cc ifTrue:[
- ign := true
- ] ifFalse:[
- ignore isString ifTrue:[
- cc == (ignore at:2) ifTrue:[
- runCol > 1 ifTrue:[
- (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
- skip := true
- ]
- ]
- ] ifFalse:[
- cc == (ignore at:1) ifTrue:[
- runCol < lineString size ifTrue:[
- (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
- skip := true
- ]
- ]
- ]
- ]
- ]
- ]
- ]
- ].
-
- ign ifTrue:[
- ignoring := ignoring not
- ].
-
- ignoring ifFalse:[
- skip ifFalse:[
- (incSet includes:cc) ifTrue:[
- nesting := nesting + 1
- ] ifFalse:[
- (decSet includes:cc) ifTrue:[
- nesting := nesting - 1
- ]
- ]
- ]
- ].
-
- nesting == 0 ifTrue:[
- "check if legal"
-
- skip ifFalse:[
- cc == closingChar ifFalse:[
- ^ failBlock value
- ].
- ^ foundBlock value:line value:runCol.
- ]
- ]
- ].
- ].
- line := line + delta.
- (line < 1 or:[line > maxLine]) ifTrue:[
- ^ failBlock value
- ].
- lineString := list at:line.
- direction == #fwd ifTrue:[
- col := 1
- ] ifFalse:[
- col := lineString size
- ]
+ (lineString notNil
+ and:[lineString includesAny:anySet]) ifTrue:[
+ direction == #fwd ifTrue:[
+ endCol := lineString size.
+ ] ifFalse:[
+ endCol := 1
+ ].
+
+ col to:endCol by:delta do:[:rCol |
+ runCol := rCol.
+
+ cc := lineString at:runCol.
+ runCol < lineString size ifTrue:[
+ nextCC := lineString at:runCol+1
+ ] ifFalse:[
+ nextCC := nil
+ ].
+ runCol > 1 ifTrue:[
+ prevCC := lineString at:runCol-1
+ ] ifFalse:[
+ prevCC := nil
+ ].
+
+ ign := skip := false.
+ (cc == $"
+ and:[nextCC == $/ or:[prevCC == $$ ]]) ifTrue:[
+ "/ do nothing
+
+ skip := true.
+ ] ifFalse:[
+ ignoreSet do:[:ignore |
+ ignore == cc ifTrue:[
+ ign := true
+ ] ifFalse:[
+ ignore isString ifTrue:[
+ cc == (ignore at:2) ifTrue:[
+ runCol > 1 ifTrue:[
+ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
+ skip := true
+ ]
+ ]
+ ] ifFalse:[
+ cc == (ignore at:1) ifTrue:[
+ runCol < lineString size ifTrue:[
+ (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
+ skip := true
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ ign ifTrue:[
+ ignoring := ignoring not
+ ].
+
+ ignoring ifFalse:[
+ skip ifFalse:[
+ (incSet includes:cc) ifTrue:[
+ nesting := nesting + 1
+ ] ifFalse:[
+ (decSet includes:cc) ifTrue:[
+ nesting := nesting - 1
+ ]
+ ]
+ ]
+ ].
+
+ nesting == 0 ifTrue:[
+ "check if legal"
+
+ skip ifFalse:[
+ cc == closingChar ifFalse:[
+ ^ failBlock value
+ ].
+ ^ foundBlock value:line value:runCol.
+ ]
+ ]
+ ].
+ ].
+ line := line + delta.
+ (line < 1 or:[line > maxLine]) ifTrue:[
+ ^ failBlock value
+ ].
+ lineString := list at:line.
+ direction == #fwd ifTrue:[
+ col := 1
+ ] ifFalse:[
+ col := lineString size
+ ]
].
^ notFoundBlock value
@@ -2315,16 +2316,16 @@
ign := lastSearchIgnoredCase ? false.
selectStyle == #wordLeft ifTrue:[
- "
- remove the space from the selection
- "
- selectionStartCol := selectionStartCol + 1.
- super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
- selectStyle := #word.
+ "
+ remove the space from the selection
+ "
+ selectionStartCol := selectionStartCol + 1.
+ super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
+ selectStyle := #word.
].
self setSearchPattern.
lastSearchPattern notNil ifTrue:[
- self
+ self
searchFwd:lastSearchPattern
ignoreCase:ign
]
@@ -2348,16 +2349,16 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
self
- searchForwardFor:pattern startingAtLine:startLine col:startCol
- ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
- ifAbsent:aBlock
+ searchForwardFor:pattern startingAtLine:startLine col:startCol
+ ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:35 / cg"
!
@@ -2379,18 +2380,18 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
self
- searchForwardFor:pattern
- ignoreCase:ign
- startingAtLine:startLine col:startCol
- ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
- ifAbsent:aBlock
+ searchForwardFor:pattern
+ ignoreCase:ign
+ startingAtLine:startLine col:startCol
+ ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:35 / cg"
"Created: 13.9.1997 / 06:18:27 / cg"
@@ -2452,11 +2453,11 @@
savedCursor := cursor.
[
- self cursor:(Cursor cross).
- self beep.
- Processor activeProcess millisecondDelay:300.
+ self cursor:(Cursor cross).
+ self beep.
+ Processor activeProcess millisecondDelay:300.
] valueNowOrOnUnwindDo:[
- self cursor:savedCursor
+ self cursor:savedCursor
]
"Modified: 20.2.1997 / 12:49:27 / cg"
@@ -2468,27 +2469,27 @@
|l t|
selectionStartLine notNil ifTrue:[
- expandingTop ifTrue:[
- l := selectionStartLine.
- selectionStartLine := selectionStartLine + 1.
- (selectionStartLine > clickLine
- or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
- ifTrue:[
- t := selectionStartLine.
- selectionStartLine := selectionEndLine.
- selectionEndLine := t.
- t := selectionStartCol.
- selectionStartCol := selectionEndCol.
- selectionEndCol := t.
- expandingTop := false
- ].
- ] ifFalse:[
- l := selectionEndLine.
- selectionEndLine := selectionEndLine + 1.
- ].
- self redrawLine:l.
- self redrawLine:l+1.
- self makeSelectionVisible.
+ expandingTop ifTrue:[
+ l := selectionStartLine.
+ selectionStartLine := selectionStartLine + 1.
+ (selectionStartLine > clickLine
+ or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
+ ifTrue:[
+ t := selectionStartLine.
+ selectionStartLine := selectionEndLine.
+ selectionEndLine := t.
+ t := selectionStartCol.
+ selectionStartCol := selectionEndCol.
+ selectionEndCol := t.
+ expandingTop := false
+ ].
+ ] ifFalse:[
+ l := selectionEndLine.
+ selectionEndLine := selectionEndLine + 1.
+ ].
+ self redrawLine:l.
+ self redrawLine:l+1.
+ self makeSelectionVisible.
].
"Created: 1.3.1996 / 23:35:08 / cg"
@@ -2499,31 +2500,31 @@
|c l t c1 c2|
selectionStartLine notNil ifTrue:[
- expandingTop ifTrue:[
- selectionStartCol == 0 ifTrue:[^ self].
- l := selectionStartLine.
- selectionStartCol := (selectionStartCol - 1) max:1.
- c := selectionStartCol.
- ] ifFalse:[
- l := selectionEndLine.
- selectionEndCol := (selectionEndCol - 1) max:0.
- c := selectionEndCol.
- selectionEndLine == selectionStartLine ifTrue:[
- selectionEndCol <= selectionStartCol ifTrue:[
- t := selectionStartCol. selectionStartCol := selectionEndCol.
- selectionEndCol := t.
- expandingTop := true.
- c := selectionStartCol.
- ]
- ].
- ].
- c1 := c.
- c2 := c1 + 1.
- c1 == 0 ifTrue:[
- c1 := 1
- ].
- self redrawLine:l from:c1 to:c2.
- self makeSelectionVisible.
+ expandingTop ifTrue:[
+ selectionStartCol == 0 ifTrue:[^ self].
+ l := selectionStartLine.
+ selectionStartCol := (selectionStartCol - 1) max:1.
+ c := selectionStartCol.
+ ] ifFalse:[
+ l := selectionEndLine.
+ selectionEndCol := (selectionEndCol - 1) max:0.
+ c := selectionEndCol.
+ selectionEndLine == selectionStartLine ifTrue:[
+ selectionEndCol <= selectionStartCol ifTrue:[
+ t := selectionStartCol. selectionStartCol := selectionEndCol.
+ selectionEndCol := t.
+ expandingTop := true.
+ c := selectionStartCol.
+ ]
+ ].
+ ].
+ c1 := c.
+ c2 := c1 + 1.
+ c1 == 0 ifTrue:[
+ c1 := 1
+ ].
+ self redrawLine:l from:c1 to:c2.
+ self makeSelectionVisible.
].
"Modified: 18.3.1996 / 17:05:46 / cg"
@@ -2533,26 +2534,26 @@
|l c t|
selectionStartLine notNil ifTrue:[
- expandingTop ifTrue:[
- l := selectionStartLine.
- c := selectionStartCol.
- selectionStartCol := selectionStartCol + 1.
- l == selectionEndLine ifTrue:[
- c >= selectionEndCol ifTrue:[
- expandingTop := false.
- t := selectionStartCol. selectionStartCol := selectionEndCol.
- selectionEndCol := t.
- c := selectionStartCol.
- ]
- ]
- ] ifFalse:[
- l := selectionEndLine.
- c := selectionEndCol.
- selectionEndCol := selectionEndCol + 1.
- ].
-
- self redrawLine:l from:c to:c+1.
- self makeSelectionVisible.
+ expandingTop ifTrue:[
+ l := selectionStartLine.
+ c := selectionStartCol.
+ selectionStartCol := selectionStartCol + 1.
+ l == selectionEndLine ifTrue:[
+ c >= selectionEndCol ifTrue:[
+ expandingTop := false.
+ t := selectionStartCol. selectionStartCol := selectionEndCol.
+ selectionEndCol := t.
+ c := selectionStartCol.
+ ]
+ ]
+ ] ifFalse:[
+ l := selectionEndLine.
+ c := selectionEndCol.
+ selectionEndCol := selectionEndCol + 1.
+ ].
+
+ self redrawLine:l from:c to:c+1.
+ self makeSelectionVisible.
].
"Created: 1.3.1996 / 23:33:17 / cg"
@@ -2563,29 +2564,29 @@
|l t|
selectionStartLine notNil ifTrue:[
- expandingTop ifTrue:[
- selectionStartLine := (selectionStartLine - 1) max:1.
- l := selectionStartLine.
- ] ifFalse:[
- selectionEndLine := (selectionEndLine - 1) max:0.
-
- l := selectionEndLine.
- (selectionEndLine < clickLine
- or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
- ifTrue:[
- t := selectionStartLine.
- selectionStartLine := selectionEndLine.
- selectionEndLine := t.
- t := selectionStartCol.
- selectionStartCol := selectionEndCol.
- selectionEndCol := t.
- l := selectionStartLine.
- expandingTop := true
- ].
- ].
- self redrawLine:l.
- self redrawLine:l+1.
- self makeSelectionVisible.
+ expandingTop ifTrue:[
+ selectionStartLine := (selectionStartLine - 1) max:1.
+ l := selectionStartLine.
+ ] ifFalse:[
+ selectionEndLine := (selectionEndLine - 1) max:0.
+
+ l := selectionEndLine.
+ (selectionEndLine < clickLine
+ or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
+ ifTrue:[
+ t := selectionStartLine.
+ selectionStartLine := selectionEndLine.
+ selectionEndLine := t.
+ t := selectionStartCol.
+ selectionStartCol := selectionEndCol.
+ selectionEndCol := t.
+ l := selectionStartLine.
+ expandingTop := true
+ ].
+ ].
+ self redrawLine:l.
+ self redrawLine:l+1.
+ self makeSelectionVisible.
].
"Modified: 6.3.1996 / 14:12:06 / cg"
@@ -2603,15 +2604,15 @@
|line col|
selectionStartLine notNil ifTrue:[
- expandingTop ~~ false ifTrue:[
- line := selectionStartLine.
- col := selectionStartCol.
- ] ifFalse:[
- line := selectionEndLine.
- col := selectionEndCol.
- ].
- self makeLineVisible:line.
- self makeColVisible:col inLine:line.
+ expandingTop ~~ false ifTrue:[
+ line := selectionStartLine.
+ col := selectionStartCol.
+ ] ifFalse:[
+ line := selectionEndLine.
+ col := selectionEndCol.
+ ].
+ self makeLineVisible:line.
+ self makeColVisible:col inLine:line.
]
"Modified: 6.3.1996 / 13:53:45 / cg"
@@ -2640,35 +2641,35 @@
self unselect.
startLine notNil ifTrue:[
- "new:"
- endLine < startLine ifTrue:[
- ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
- ].
- (endLine == startLine and:[endCol < startCol]) ifTrue:[
- endCol ~~ 0 ifTrue:[
- self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
- ].
- ^ self
- ].
+ "new:"
+ endLine < startLine ifTrue:[
+ ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
+ ].
+ (endLine == startLine and:[endCol < startCol]) ifTrue:[
+ endCol ~~ 0 ifTrue:[
+ self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
+ ].
+ ^ self
+ ].
" old:
- endLine < startLine ifTrue:[^ self].
- (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
+ endLine < startLine ifTrue:[^ self].
+ (startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
"
- selectionStartLine := startLine.
- selectionStartCol := startCol.
- selectionEndLine := endLine.
- selectionEndCol := endCol.
- self validateNewSelection.
-
- (selectionStartLine == selectionEndLine) ifTrue:[
- self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
- ] ifFalse:[
- selectionStartLine to:selectionEndLine do:[:lineNr |
- self redrawLine:lineNr
- ]
- ].
- selectStyle := nil.
+ selectionStartLine := startLine.
+ selectionStartCol := startCol.
+ selectionEndLine := endLine.
+ selectionEndCol := endCol.
+ self validateNewSelection.
+
+ (selectionStartLine == selectionEndLine) ifTrue:[
+ self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
+ ] ifFalse:[
+ selectionStartLine to:selectionEndLine do:[:lineNr |
+ self redrawLine:lineNr
+ ]
+ ].
+ selectStyle := nil.
]
"
@@ -2742,10 +2743,10 @@
"select the word at given line/col"
self wordAtLine:line col:col do:[
- :beginLine :beginCol :endLine :endCol :style |
-
- self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
- selectStyle := style
+ :beginLine :beginCol :endLine :endCol :style |
+
+ self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
+ selectStyle := style
]
"Modified: 18.3.1996 / 17:30:38 / cg"
@@ -2760,8 +2761,8 @@
selectVisibleLine := self visibleLineOfY:y.
selectLine := self visibleLineToListLine:selectVisibleLine.
selectLine notNil ifTrue:[
- selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
- self selectWordAtLine:selectLine col:selectCol
+ selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
+ self selectWordAtLine:selectLine col:selectCol
]
"Modified: / 8.9.1998 / 21:22:46 / cg"
@@ -2829,34 +2830,34 @@
|startLine endLine startVisLine endVisLine|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- endLine := selectionEndLine.
-
- self unselectWithoutRedraw.
-
- "/ if the selection is not visible, we are done
-
- startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
- endLine < firstLineShown ifTrue:[^ self].
-
- startLine < firstLineShown ifTrue:[
- startVisLine := 1
- ] ifFalse:[
- startVisLine := self listLineToVisibleLine:startLine
- ].
- endLine >= (firstLineShown + nLinesShown) ifTrue:[
- endVisLine := nLinesShown
- ] ifFalse:[
- endVisLine := self listLineToVisibleLine:endLine
- ].
-
- "/ if its only part of a line, just redraw what has to be
-
- (startLine == endLine) ifTrue:[
- super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
- ] ifFalse:[
- self redrawFromVisibleLine:startVisLine to:endVisLine
- ].
+ startLine := selectionStartLine.
+ endLine := selectionEndLine.
+
+ self unselectWithoutRedraw.
+
+ "/ if the selection is not visible, we are done
+
+ startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
+ endLine < firstLineShown ifTrue:[^ self].
+
+ startLine < firstLineShown ifTrue:[
+ startVisLine := 1
+ ] ifFalse:[
+ startVisLine := self listLineToVisibleLine:startLine
+ ].
+ endLine >= (firstLineShown + nLinesShown) ifTrue:[
+ endVisLine := nLinesShown
+ ] ifFalse:[
+ endVisLine := self listLineToVisibleLine:endLine
+ ].
+
+ "/ if its only part of a line, just redraw what has to be
+
+ (startLine == endLine) ifTrue:[
+ super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
+ ] ifFalse:[
+ self redrawFromVisibleLine:startVisLine to:endVisLine
+ ].
].
selectStyle := nil
@@ -2886,5 +2887,5 @@
!TextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.123 1998-09-18 12:46:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.124 1999-01-07 12:09:16 cg Exp $'
! !