--- a/TextView.st Tue Jul 19 17:23:51 2016 +0200
+++ b/TextView.st Tue Jul 19 21:45:20 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -11,6 +9,8 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+'From Smalltalk/X, Version:7.1.0.0 on 15-07-2016 at 17:19:36' !
+
"{ Package: 'stx:libwidg' }"
"{ NameSpace: Smalltalk }"
@@ -303,7 +303,7 @@
#'text.wordSelectCatchesBlanks'
#'text.st80Selections')>
- DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White.
+ DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
"/ DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor.
@@ -387,261 +387,261 @@
<resource: #canvas>
- ^
+ ^
#(FullSpec
name: searchDialogSpec
- window:
+ window:
(WindowSpec
- label: 'String search'
- name: 'String search'
- min: (Point 10 10)
- max: (Point 1280 1024)
- bounds: (Rectangle 0 0 475 376)
+ label: 'String search'
+ name: 'String search'
+ min: (Point 10 10)
+ max: (Point 1280 1024)
+ bounds: (Rectangle 0 0 475 376)
)
- component:
+ component:
(SpecCollection
- collection: (
- (LabelSpec
- label: 'SearchPattern:'
- name: 'label'
- layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
- level: 0
- translateLabel: true
- adjust: left
- )
- (ComboBoxSpec
- name: 'patternComboBox'
- layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
- activeHelpKey: searchPattern
- tabable: true
- model: searchPattern
- immediateAccept: false
- acceptOnLeave: true
- acceptOnReturn: true
- acceptOnTab: true
- acceptOnLostFocus: true
- acceptOnPointerLeave: false
- autoSelectInitialText: true
- comboList: patternList
- )
- (VerticalPanelViewSpec
- name: 'VerticalPanel1'
- layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
- horizontalLayout: fit
- verticalLayout: top
- component:
- (SpecCollection
- collection: (
- (CheckBoxSpec
- label: 'Case Sensitive'
- name: 'ignoreCaseCheckBox'
- activeHelpKey: searchCaseSensitive
- level: 0
- tabable: true
- model: caseSensitive
- translateLabel: true
- extent: (Point 475 24)
- )
- (ViewSpec
- name: 'MatchBox'
- component:
- (SpecCollection
- collection: (
- (CheckBoxSpec
- label: 'Match (forward only)'
- name: 'matchCheckBox'
- layout: (LayoutFrame 0 0 0 0 260 0 0 1)
- activeHelpKey: matchSearch
- level: 0
- tabable: true
- model: match
- translateLabel: true
- )
- (CheckBoxSpec
- label: 'Regex Match'
- name: 'CheckBox6'
- layout: (LayoutFrame -170 1 0 0 0 1 22 0)
- activeHelpKey: matchWithRegex
- enableChannel: matchWithRegexVisible
- model: matchWithRegex
- translateLabel: true
- )
- )
-
- )
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: 'Search Full Words'
- name: 'CheckBox2'
- activeHelpKey: searchFullWord
- level: 0
- enableChannel: searchFullWordEnabled
- tabable: true
- model: searchFullWord
- translateLabel: true
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: 'At Begin of Line Only'
- name: 'CheckBox5'
- activeHelpKey: searchAtBeginOfLineOnly
- level: 0
- tabable: true
- model: searchAtBeginOfLineOnly
- translateLabel: true
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: 'Variable Only'
- name: 'CheckBox1'
- activeHelpKey: searchVariable
- level: 0
- visibilityChannel: searchVariableVisible
- enableChannel: searchVariableEnabled
- tabable: true
- model: searchVariable
- translateLabel: true
- labelChannel: stringWithVariableUnderCursorHolder
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: 'Select Lines'
- name: 'CheckBox3'
- activeHelpKey: selectLines
- level: 0
- initiallyInvisible: true
- tabable: true
- model: selectLinesHolder
- translateLabel: true
- extent: (Point 429 24)
- )
- (CheckBoxSpec
- label: 'Wrap at End of Text (forward only)'
- name: 'CheckBox7'
- activeHelpKey: searchWithWrap
- level: 0
- tabable: true
- model: wrapAtEndOfTextHolder
- translateLabel: true
- extent: (Point 475 24)
- )
- (ViewSpec
- name: 'Box1'
- extent: (Point 475 10)
- )
- (HorizontalPanelViewSpec
- name: 'HorizontalPanel1'
- horizontalLayout: leftFit
- verticalLayout: fit
- ignoreInvisibleComponents: false
- elementsChangeSize: true
- component:
- (SpecCollection
- collection: (
- (CheckBoxSpec
- label: 'Replace By:'
- name: 'CheckBox4'
- activeHelpKey: replaceText
- level: 0
- enableChannel: replaceEnabled
- tabable: true
- model: replaceBoolean
- translateLabel: true
- resizeForLabel: true
- useDefaultExtent: true
- )
- (InputFieldSpec
- name: 'ReplaceEntryField'
- activeHelpKey: replaceText
- visibilityChannel: replaceBoolean
- enableChannel: replaceBoolean
- model: replaceTextHolder
- acceptOnReturn: true
- acceptOnTab: true
- acceptOnPointerLeave: true
- extent: (Point 297 24)
- )
- )
-
- )
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: ' Replace All (to End of Text)'
- name: 'CheckBox8'
- activeHelpKey: replaceAll
- level: 0
- enableChannel: replaceBoolean
- tabable: true
- model: replaceAllBoolean
- translateLabel: true
- extent: (Point 475 24)
- )
- (CheckBoxSpec
- label: ' Preserve Case'
- name: 'CheckBox9'
- activeHelpKey: replacePreserveCase
- level: 0
- enableChannel: replaceBoolean
- tabable: true
- model: replacePreserveCaseBoolean
- translateLabel: true
- extent: (Point 475 24)
- )
- )
-
- )
- )
- (HorizontalPanelViewSpec
- name: 'horizontalPanelView'
- layout: (LayoutFrame 0 0.0 -32 1.0 -16 1.0 0 1.0)
- level: 0
- horizontalLayout: fitSpace
- verticalLayout: center
- horizontalSpace: 3
- verticalSpace: 3
- ignoreInvisibleComponents: true
- reverseOrderIfOKAtLeft: true
- component:
- (SpecCollection
- collection: (
- (ActionButtonSpec
- label: 'Cancel'
- name: 'cancelButton'
- level: 2
- translateLabel: true
- tabable: true
- model: cancel
- useDefaultExtent: true
- )
- (ActionButtonSpec
- label: 'Prev'
- name: 'prevButton'
- level: 2
- translateLabel: true
- tabable: true
- model: prevAction
- useDefaultExtent: true
- )
- (ActionButtonSpec
- label: 'Next'
- name: 'nextButton'
- level: 2
- borderWidth: 1
- translateLabel: true
- tabable: true
- model: nextAction
- isDefault: true
- useDefaultExtent: true
- )
- )
-
- )
- keepSpaceForOSXResizeHandleH: true
- )
- )
-
+ collection: (
+ (LabelSpec
+ label: 'SearchPattern:'
+ name: 'label'
+ layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
+ level: 0
+ translateLabel: true
+ adjust: left
+ )
+ (ComboBoxSpec
+ name: 'patternComboBox'
+ layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0)
+ activeHelpKey: searchPattern
+ tabable: true
+ model: searchPattern
+ immediateAccept: false
+ acceptOnLeave: true
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnLostFocus: true
+ acceptOnPointerLeave: false
+ autoSelectInitialText: true
+ comboList: patternList
+ )
+ (VerticalPanelViewSpec
+ name: 'VerticalPanel1'
+ layout: (LayoutFrame 0 0.0 52 0 0 1.0 -32 1)
+ horizontalLayout: fit
+ verticalLayout: top
+ component:
+ (SpecCollection
+ collection: (
+ (CheckBoxSpec
+ label: 'Case Sensitive'
+ name: 'ignoreCaseCheckBox'
+ activeHelpKey: searchCaseSensitive
+ level: 0
+ tabable: true
+ model: caseSensitive
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ (ViewSpec
+ name: 'MatchBox'
+ component:
+ (SpecCollection
+ collection: (
+ (CheckBoxSpec
+ label: 'Match (forward only)'
+ name: 'matchCheckBox'
+ layout: (LayoutFrame 0 0 0 0 260 0 0 1)
+ activeHelpKey: matchSearch
+ level: 0
+ tabable: true
+ model: match
+ translateLabel: true
+ )
+ (CheckBoxSpec
+ label: 'Regex Match'
+ name: 'CheckBox6'
+ layout: (LayoutFrame -170 1 0 0 0 1 22 0)
+ activeHelpKey: matchWithRegex
+ enableChannel: matchWithRegexVisible
+ model: matchWithRegex
+ translateLabel: true
+ )
+ )
+
+ )
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: 'Search Full Words'
+ name: 'CheckBox2'
+ activeHelpKey: searchFullWord
+ level: 0
+ enableChannel: searchFullWordEnabled
+ tabable: true
+ model: searchFullWord
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: 'At Begin of Line Only'
+ name: 'CheckBox5'
+ activeHelpKey: searchAtBeginOfLineOnly
+ level: 0
+ tabable: true
+ model: searchAtBeginOfLineOnly
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: 'Variable Only'
+ name: 'CheckBox1'
+ activeHelpKey: searchVariable
+ level: 0
+ visibilityChannel: searchVariableVisible
+ enableChannel: searchVariableEnabled
+ tabable: true
+ model: searchVariable
+ translateLabel: true
+ labelChannel: stringWithVariableUnderCursorHolder
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: 'Select Lines'
+ name: 'CheckBox3'
+ activeHelpKey: selectLines
+ level: 0
+ initiallyInvisible: true
+ tabable: true
+ model: selectLinesHolder
+ translateLabel: true
+ extent: (Point 429 24)
+ )
+ (CheckBoxSpec
+ label: 'Wrap at End of Text (forward only)'
+ name: 'CheckBox7'
+ activeHelpKey: searchWithWrap
+ level: 0
+ tabable: true
+ model: wrapAtEndOfTextHolder
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ (ViewSpec
+ name: 'Box1'
+ extent: (Point 475 10)
+ )
+ (HorizontalPanelViewSpec
+ name: 'HorizontalPanel1'
+ horizontalLayout: leftFit
+ verticalLayout: fit
+ ignoreInvisibleComponents: false
+ elementsChangeSize: true
+ component:
+ (SpecCollection
+ collection: (
+ (CheckBoxSpec
+ label: 'Replace By:'
+ name: 'CheckBox4'
+ activeHelpKey: replaceText
+ level: 0
+ enableChannel: replaceEnabled
+ tabable: true
+ model: replaceBoolean
+ translateLabel: true
+ resizeForLabel: true
+ useDefaultExtent: true
+ )
+ (InputFieldSpec
+ name: 'ReplaceEntryField'
+ activeHelpKey: replaceText
+ visibilityChannel: replaceBoolean
+ enableChannel: replaceBoolean
+ model: replaceTextHolder
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnPointerLeave: true
+ extent: (Point 297 24)
+ )
+ )
+
+ )
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: ' Replace All (to End of Text)'
+ name: 'CheckBox8'
+ activeHelpKey: replaceAll
+ level: 0
+ enableChannel: replaceBoolean
+ tabable: true
+ model: replaceAllBoolean
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ (CheckBoxSpec
+ label: ' Preserve Case'
+ name: 'CheckBox9'
+ activeHelpKey: replacePreserveCase
+ level: 0
+ enableChannel: replaceBoolean
+ tabable: true
+ model: replacePreserveCaseBoolean
+ translateLabel: true
+ extent: (Point 475 24)
+ )
+ )
+
+ )
+ )
+ (HorizontalPanelViewSpec
+ name: 'horizontalPanelView'
+ layout: (LayoutFrame 0 0.0 -32 1.0 -16 1.0 0 1.0)
+ level: 0
+ horizontalLayout: fitSpace
+ verticalLayout: center
+ horizontalSpace: 3
+ verticalSpace: 3
+ ignoreInvisibleComponents: true
+ reverseOrderIfOKAtLeft: true
+ component:
+ (SpecCollection
+ collection: (
+ (ActionButtonSpec
+ label: 'Cancel'
+ name: 'cancelButton'
+ level: 2
+ translateLabel: true
+ tabable: true
+ model: cancel
+ useDefaultExtent: true
+ )
+ (ActionButtonSpec
+ label: 'Prev'
+ name: 'prevButton'
+ level: 2
+ translateLabel: true
+ tabable: true
+ model: prevAction
+ useDefaultExtent: true
+ )
+ (ActionButtonSpec
+ label: 'Next'
+ name: 'nextButton'
+ level: 2
+ borderWidth: 1
+ translateLabel: true
+ tabable: true
+ model: nextAction
+ isDefault: true
+ useDefaultExtent: true
+ )
+ )
+
+ )
+ keepSpaceForOSXResizeHandleH: true
+ )
+ )
+
)
)
! !
@@ -798,7 +798,7 @@
setupForFile:aFileName
"setup a textView on a file; return the textView"
- |textView f|
+ |textView|
textView := self setupEmpty.
aFileName notNil ifTrue:[
@@ -1268,8 +1268,9 @@
|fontsEncoding msg filter f defaultFont pref matchingFonts
matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts
- matchingFamilyFaceStyleSizeFonts|
-
+ matchingFamilyFaceStyleSizeFonts font|
+
+ font := gc font.
fontsEncoding := font encoding.
pref := FontDescription preferredFontEncodingFor:newEncoding.
@@ -1344,27 +1345,27 @@
"mouse-move while button was pressed - handle selection changes"
(clickLine isNil or:[clickPos isNil]) ifTrue:[
- dragIsActive := false.
- ^ self
+ dragIsActive := false.
+ ^ self
].
dragIsActive ifTrue:[
- (clickPos dist:(x@y)) >= 5.0 ifTrue:[
- dragIsActive := false.
-
- self hasSelection ifTrue:[
- dropSource startDragIn:self at:(x@y)
- ]
- ].
- ^ self
+ (clickPos dist:(x@y)) >= 5.0 ifTrue:[
+ dragIsActive := false.
+
+ self hasSelection ifTrue:[
+ dropSource startDragIn:self at:(x@y)
+ ]
+ ].
+ ^ self
].
"is it the select or 1-button ?"
buttonState == 0 ifTrue:[^ self].
self sensor leftButtonPressed ifFalse:[
- "/ self setPrimarySelection.
- "/ self selectionChanged.
- ^ self
+ "/ self setPrimarySelection.
+ "/ self selectionChanged.
+ ^ self
].
"/ (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[
"/ (device buttonMotionMask:buttonState includesButton:1) ifFalse:[
@@ -1375,33 +1376,33 @@
"if moved outside of view, start autoscroll"
((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[
- self compressMotionEvents:false.
- (self startAutoScrollUp:y negated) ifTrue:[
- ^ self
- ].
+ self compressMotionEvents:false.
+ (self startAutoScrollUp:y negated) ifTrue:[
+ ^ self
+ ].
].
(y > height) ifTrue:[
- self compressMotionEvents:false.
- (self startAutoScrollDown:(y - height)) ifTrue:[
- ^ self
- ].
+ self compressMotionEvents:false.
+ (self startAutoScrollDown:(y - height)) ifTrue:[
+ ^ self
+ ].
].
((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
- self compressMotionEvents:false.
- (self startAutoScrollLeft:x) ifTrue:[
- ^ self
- ].
+ self compressMotionEvents:false.
+ (self startAutoScrollLeft:x) ifTrue:[
+ ^ self
+ ].
].
(x > width) ifTrue:[
- self compressMotionEvents:false.
- (self startAutoScrollRight:(x - width)) ifTrue:[
- ^ self
- ].
+ self compressMotionEvents:false.
+ (self startAutoScrollRight:(x - width)) ifTrue:[
+ ^ self
+ ].
].
"move inside - stop autoscroll if any"
autoScrollBlock notNil ifTrue:[
- self stopScrollSelect
+ self stopScrollSelect
].
self extendSelectionToX:x y:y setPrimarySelection:false.
@@ -1481,20 +1482,20 @@
"mouse- button release - turn off autoScroll if any"
(button == 1) ifTrue:[
- self hasSelection ifTrue:[
- self setPrimarySelection.
- self selectionChanged.
- ].
-
- autoScrollBlock notNil ifTrue:[
- self stopScrollSelect
- ].
- dragIsActive ifTrue:[
- self unselect
- ].
- clickPos := nil.
+ self hasSelection ifTrue:[
+ self setPrimarySelection.
+ self selectionChanged.
+ ].
+
+ autoScrollBlock notNil ifTrue:[
+ self stopScrollSelect
+ ].
+ dragIsActive ifTrue:[
+ self unselect
+ ].
+ clickPos := nil.
] ifFalse:[
- super buttonRelease:button x:x y:y
+ super buttonRelease:button x:x y:y
].
dragIsActive := false.
@@ -1516,153 +1517,153 @@
"
((sel := self selection) size == 1
and:[(sel := sel at:1) size == 1]) ifTrue:[
- ch := sel at:1.
-
- ((self isOpeningParenthesis:ch)
- or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
- self
- searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
- ifFound:[:line :col |
- |prevLine prevCol moveBack pos1|
-
- prevLine := firstLineShown.
- prevCol := viewOrigin x.
- self selectFromLine:selectionStartLine col:selectionStartCol
- toLine:line col:col.
-
- self sensor ctrlDown ifFalse:[
- "/ undo scroll operation ...
- self withCursor:Cursor eye do:[
- |delayCount|
-
- moveBack := false.
- (self isClosingParenthesis:ch) ifTrue:[
- (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
- moveBack := true
- ]
- ] ifFalse:[
- selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
- self makeLineVisible:selectionEndLine.
- moveBack := true
- ]
- ].
- moveBack ifTrue:[
- delayCount := 0.
- pos1 := x@y.
- self invalidateRepairNow:true.
- Delay waitForSeconds:MatchDelayTime.
- delayCount := delayCount + MatchDelayTime.
- [self sensor hasUserEventFor:self] whileFalse:[
- Delay waitForSeconds:MatchDelayTime / 2.
- delayCount := delayCount + (MatchDelayTime / 2).
- delayCount > 2 ifTrue:[
- self cursor:Cursor eyeClosed.
- ].
- delayCount >= 2.3 ifTrue:[
- self cursor:Cursor eye.
- delayCount := 0.
- ]
- ].
- self scrollToLine:prevLine; scrollToCol:prevCol.
- ].
- ]
- ].
- ^ self.
- ]
- ifNotFound:[self showNotFound]
- onError:[self beep]
- openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
- closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
- selectStyle := nil
- ]
+ ch := sel at:1.
+
+ ((self isOpeningParenthesis:ch)
+ or:[ (self isClosingParenthesis:ch) ]) ifTrue:[
+ self
+ searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
+ ifFound:[:line :col |
+ |prevLine prevCol moveBack pos1|
+
+ prevLine := firstLineShown.
+ prevCol := viewOrigin x.
+ self selectFromLine:selectionStartLine col:selectionStartCol
+ toLine:line col:col.
+
+ self sensor ctrlDown ifFalse:[
+ "/ undo scroll operation ...
+ self withCursor:Cursor eye do:[
+ |delayCount|
+
+ moveBack := false.
+ (self isClosingParenthesis:ch) ifTrue:[
+ (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
+ moveBack := true
+ ]
+ ] ifFalse:[
+ selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
+ self makeLineVisible:selectionEndLine.
+ moveBack := true
+ ]
+ ].
+ moveBack ifTrue:[
+ delayCount := 0.
+ pos1 := x@y.
+ self invalidateRepairNow:true.
+ Delay waitForSeconds:MatchDelayTime.
+ delayCount := delayCount + MatchDelayTime.
+ [self sensor hasUserEventFor:self] whileFalse:[
+ Delay waitForSeconds:MatchDelayTime / 2.
+ delayCount := delayCount + (MatchDelayTime / 2).
+ delayCount > 2 ifTrue:[
+ self cursor:Cursor eyeClosed.
+ ].
+ delayCount >= 2.3 ifTrue:[
+ self cursor:Cursor eye.
+ delayCount := 0.
+ ]
+ ].
+ self scrollToLine:prevLine; scrollToCol:prevCol.
+ ].
+ ]
+ ].
+ ^ self.
+ ]
+ ifNotFound:[self showNotFound]
+ onError:[self beep]
+ openingCharacters:((parenthesisSpecification at:#open) ", '([{'")
+ closingCharacters:((parenthesisSpecification at:#close) ", ')]}'").
+ selectStyle := nil
+ ]
].
(self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[
- "/ st80 selects:
- "/ - if clicked right after a parenthesis -> select to matching parenthesis
- "/ - if clicked right after a quote -> select to matching quote (unless escaped ;-)
- "/ - if clicked at beginning of the line -> select that line
- "/ - if clicked at the top of the text -> select all
- "/ however, do none of the above, if clicked on a parenthesis
- 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.
- (self isOpeningParenthesis:ch) ifTrue:[
- matchCol := clickCol - 1
- ] ifFalse:[
- ('"''|' includes:ch) ifTrue:[
- scanCol := clickCol - 1.
- fwdScan := true.
- scanCh := ch.
- ]
- ]
- ].
- fwdSelect := true.
- (matchCol isNil and:[scanCol isNil]) ifTrue:[
- clickCol < (self listAt:clickLine) size ifTrue:[
- ch := self characterAtLine:clickLine col:clickCol+1.
- (self isClosingParenthesis:ch) ifTrue:[
- matchCol := clickCol + 1.
- fwdSelect := false.
- ] ifFalse:[
- ('"''|' includes:ch) ifTrue:[
- scanCol := clickCol + 1.
- fwdScan := false.
- scanCh := ch.
- ]
- ]
- ].
- ].
- matchCol notNil ifTrue:[
- self
- searchForMatchingParenthesisFromLine:clickLine col:matchCol
- ifFound:[:line :col |
- self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
- toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
- ifNotFound:[self showNotFound]
- onError:[self beep]
- openingCharacters:((parenthesisSpecification at:#open) , '([{')
- closingCharacters:((parenthesisSpecification at:#close) , ')]}').
- ^ 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:scanCh fromLine:clickLine col:scanCol forward:fwdScan
- ifFound:[:line :col |
- |selStart selEnd|
-
- fwdScan ifTrue:[
- selStart := scanCol+1.
- selEnd := col-1.
- ] ifFalse:[
- selStart := scanCol-1.
- selEnd := col+1.
- ].
- self selectFromLine:clickLine col:selStart
- toLine:line col:selEnd.
- ^ self
- ]
- ifNotFound:[self showNotFound].
- ^ self
- ]
+ "/ st80 selects:
+ "/ - if clicked right after a parenthesis -> select to matching parenthesis
+ "/ - if clicked right after a quote -> select to matching quote (unless escaped ;-)
+ "/ - if clicked at beginning of the line -> select that line
+ "/ - if clicked at the top of the text -> select all
+ "/ however, do none of the above, if clicked on a parenthesis
+ 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.
+ (self isOpeningParenthesis:ch) ifTrue:[
+ matchCol := clickCol - 1
+ ] ifFalse:[
+ ('"''|' includes:ch) ifTrue:[
+ scanCol := clickCol - 1.
+ fwdScan := true.
+ scanCh := ch.
+ ]
+ ]
+ ].
+ fwdSelect := true.
+ (matchCol isNil and:[scanCol isNil]) ifTrue:[
+ clickCol < (self listAt:clickLine) size ifTrue:[
+ ch := self characterAtLine:clickLine col:clickCol+1.
+ (self isClosingParenthesis:ch) ifTrue:[
+ matchCol := clickCol + 1.
+ fwdSelect := false.
+ ] ifFalse:[
+ ('"''|' includes:ch) ifTrue:[
+ scanCol := clickCol + 1.
+ fwdScan := false.
+ scanCh := ch.
+ ]
+ ]
+ ].
+ ].
+ matchCol notNil ifTrue:[
+ self
+ searchForMatchingParenthesisFromLine:clickLine col:matchCol
+ ifFound:[:line :col |
+ self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1)
+ toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)]
+ ifNotFound:[self showNotFound]
+ onError:[self beep]
+ openingCharacters:((parenthesisSpecification at:#open) , '([{')
+ closingCharacters:((parenthesisSpecification at:#close) , ')]}').
+ ^ 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:scanCh fromLine:clickLine col:scanCol forward:fwdScan
+ ifFound:[:line :col |
+ |selStart selEnd|
+
+ fwdScan ifTrue:[
+ selStart := scanCol+1.
+ selEnd := col-1.
+ ] ifFalse:[
+ selStart := scanCol-1.
+ selEnd := col+1.
+ ].
+ self selectFromLine:clickLine col:selStart
+ toLine:line col:selEnd.
+ ^ self
+ ]
+ ifNotFound:[self showNotFound].
+ ^ self
+ ]
].
"
@@ -1671,14 +1672,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-09-1997 / 04:12:55 / cg"
@@ -1702,156 +1703,156 @@
movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
(x < leftMargin) ifTrue:[
- movedCol := 0
+ movedCol := 0
] ifFalse:[
- movedCol := self colOfX:x inVisibleLine:movedVisibleLine
+ movedCol := self colOfX:x inVisibleLine:movedVisibleLine
].
y < 0 ifTrue:[
- movedCol := 0
+ movedCol := 0
].
((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
- selectionStartLine notNil ifTrue:[
- ^ self
- ].
- (clickPos isNil
- or:[(clickPos x - x) abs < 3
- and:[(clickPos y - y) abs < 3]]) ifTrue:[
- ^ self
- ].
- selectionStartLine := clickLine.
- selectionStartCol := clickCol.
- selectionEndLine := selectionStartLine.
- selectionEndCol := selectionStartCol.
-
- oldStartLine := selectionStartLine.
- oldEndLine := selectionEndLine.
- oldStartCol := selectionStartCol.
- oldEndCol := selectionEndCol-1.
+ selectionStartLine notNil ifTrue:[
+ ^ self
+ ].
+ (clickPos isNil
+ or:[(clickPos x - x) abs < 3
+ and:[(clickPos y - y) abs < 3]]) ifTrue:[
+ ^ self
+ ].
+ selectionStartLine := clickLine.
+ selectionStartCol := clickCol.
+ selectionEndLine := selectionStartLine.
+ selectionEndCol := selectionStartCol.
+
+ oldStartLine := selectionStartLine.
+ oldEndLine := selectionEndLine.
+ oldStartCol := selectionStartCol.
+ oldEndCol := selectionEndCol-1.
] ifFalse:[
- selectionStartLine isNil ifTrue:[
- selectionStartLine := selectionEndLine := clickLine.
- selectionStartCol := selectionEndCol := clickCol.
- ].
- oldStartLine := selectionStartLine.
- oldEndLine := selectionEndLine.
- oldStartCol := selectionStartCol.
- oldEndCol := selectionEndCol.
+ selectionStartLine isNil ifTrue:[
+ selectionStartLine := selectionEndLine := clickLine.
+ selectionStartCol := selectionEndCol := clickCol.
+ ].
+ oldStartLine := selectionStartLine.
+ oldEndLine := selectionEndLine.
+ oldStartCol := selectionStartCol.
+ oldEndCol := selectionEndCol.
].
oldEndLine isNil ifTrue:[
- oldEndLine := selectionEndLine ? clickLine ? movedLine.
+ oldEndLine := selectionEndLine ? clickLine ? movedLine.
].
oldEndCol isNil ifTrue:[
- oldEndCol := selectionEndCol ? clickCol.
+ oldEndCol := selectionEndCol ? clickCol.
].
"find out if we are before or after initial click"
movedUp := false.
clickStartLine isNil ifTrue:[
- clickStartLine := movedLine.
+ clickStartLine := movedLine.
].
clickStartCol isNil ifTrue:[
- clickStartCol := movedCol.
+ clickStartCol := movedCol.
].
(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.
aBoolean ifTrue:[
- self setPrimarySelection.
- self selectionChanged.
+ self setPrimarySelection.
+ self selectionChanged.
].
"/ The searchAction is mantained until a cut/replace or a search with a user selection is done
"/ self clearSearchAction.
(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?selectionStartLine min:selectionStartLine)
- to:(oldStartLine?selectionStartLine max:selectionStartLine)
+ self
+ redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine)
+ to:(oldStartLine?selectionStartLine max:selectionStartLine)
].
(oldEndLine == selectionEndLine) ifTrue:[
- (oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
- self redrawLine:oldEndLine
- from:((selectionEndCol min:oldEndCol) max:1)
- to:((selectionEndCol max:oldEndCol) max:1)
- ]
+ (oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[
+ self redrawLine:oldEndLine
+ from:((selectionEndCol min:oldEndCol) max:1)
+ to:((selectionEndCol max:oldEndCol) max:1)
+ ]
] ifFalse:[
- selectionEndLine isNil ifTrue:[
- selectionStartLine := nil.
- self redraw.
- ] ifFalse:[
- (selectionStartLine notNil) ifTrue:[
- self redrawFromLine:(oldEndLine min:selectionEndLine)
- to:(oldEndLine max:selectionEndLine)
- ]
- ]
+ selectionEndLine isNil ifTrue:[
+ selectionStartLine := nil.
+ self redraw.
+ ] ifFalse:[
+ (selectionStartLine notNil) ifTrue:[
+ self redrawFromLine:(oldEndLine min:selectionEndLine)
+ to:(oldEndLine max:selectionEndLine)
+ ]
+ ]
].
clickLine := movedLine.
clickCol := movedCol
@@ -1953,21 +1954,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 gray
- ] 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 gray
+ ] ifFalse:[
+ selectionBgColor := fgColor
+ ]
+ ]
].
"Modified: / 22-01-1997 / 11:57:53 / cg"
@@ -1983,7 +1984,7 @@
lastSearchIgnoredCase := true.
parenthesisSpecification isNil ifTrue:[
- parenthesisSpecification := DefaultParenthesisSpecification.
+ parenthesisSpecification := DefaultParenthesisSpecification.
].
"I handle menus myself"
@@ -2034,28 +2035,28 @@
|newFont fp userPrefs fontPrefs newFontPrefs|
self withWaitCursorDo:[
- fp := FontPanel new.
- fp withChangeFontInViewsAllCheckBox:true.
- newFont := fp fontFromUserInitial:font.
+ fp := FontPanel new.
+ fp withChangeFontInViewsAllCheckBox:true.
+ newFont := fp fontFromUserInitial:gc font.
].
newFont notNil ifTrue:[
- self font:newFont.
- fp changeFontInAllViews ifTrue:[
- "/ user checked this box - change the defaults,
- "/ and update all other textviews now.
- userPrefs := UserPreferences current.
- fontPrefs := userPrefs fontPreferences.
- fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
-
- TextView defaultFont:newFont.
- fontPrefs at:#Text put:(newFont storeString).
- newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
- userPrefs beModified.
- DebugView newDebugger.
- TextView allSubInstances do:[:v |
- v font:newFont
- ].
- ].
+ self font:newFont.
+ fp changeFontInAllViews ifTrue:[
+ "/ user checked this box - change the defaults,
+ "/ and update all other textviews now.
+ userPrefs := UserPreferences current.
+ fontPrefs := userPrefs fontPreferences.
+ fontPrefs isNil ifTrue:[ fontPrefs := newFontPrefs := Dictionary new ].
+
+ TextView defaultFont:newFont.
+ fontPrefs at:#Text put:(newFont storeString).
+ newFontPrefs notNil ifTrue:[ userPrefs fontPreferences:newFontPrefs ].
+ userPrefs beModified.
+ DebugView newDebugger.
+ TextView allSubInstances do:[:v |
+ v font:newFont
+ ].
+ ].
]
"Modified: 27.2.1996 / 00:53:51 / cg"
@@ -2152,11 +2153,12 @@
!
fontLargerOrSmaller:largerBoolean
- |newFont|
-
- newFont := font asSize:(largerBoolean
- ifTrue:[font size + 1]
- ifFalse:[(font size-1) max:4]).
+ |oldFont newFont|
+
+ oldFont := gc font.
+ newFont := oldFont asSize:(largerBoolean
+ ifTrue:[oldFont size + 1]
+ ifFalse:[(oldFont size-1) max:4]).
self font:newFont.
"Modified: / 27-02-1996 / 00:53:51 / cg"
@@ -2241,26 +2243,26 @@
searchAtBeginOfLineOnlyHolder updateReturnKeyBehavior|
searchBarActionBlock notNil ifTrue:[
- self resetVariablesBeforeNewSearch.
- searchBarActionBlock value:#search value:self.
- ^ self
+ self resetVariablesBeforeNewSearch.
+ searchBarActionBlock value:#search value:self.
+ ^ self
].
modal := (UserPreferences current searchDialogIsModal). "/ that's experimental
(searchBox := self objectAttributeAt:#currentModelessSearchBox) notNil ifTrue:[
- (modal not
- and:[ searchBox window realized ]) ifTrue:[
- "/ reuse it.
- searchBox window
- raiseDeiconified;
- requestFocus;
- assignKeyboardFocusToFirstKeyboardConsumer.
- ^ self.
- ].
- searchBox closeRequest.
+ (modal not
+ and:[ searchBox window realized ]) ifTrue:[
+ "/ reuse it.
+ searchBox window
+ raiseDeiconified;
+ requestFocus;
+ assignKeyboardFocusToFirstKeyboardConsumer.
+ ^ self.
+ ].
+ searchBox closeRequest.
].
-
+
ign := lastSearchIgnoredCase "? LastSearchIgnoredCase " ? true.
caseHolder := ign not asValue.
@@ -2283,166 +2285,166 @@
self setSearchPatternWithMatchEscapes: match.
lastSearchPattern notNil ifTrue:[
- initialString := lastSearchPattern.
+ initialString := lastSearchPattern.
].
"/ No longer force the current selection to be the initialString
"/ self hasSelectionWithinSingleLine ifTrue:[
"/ initialString := self selection asString.
"/ ].
initialString isNil ifTrue:[
- LastSearchPatterns size > 0 ifTrue:[
- initialString := LastSearchPatterns first.
- ]
+ LastSearchPatterns size > 0 ifTrue:[
+ initialString := LastSearchPatterns first.
+ ]
].
initialString notNil ifTrue:[
- patternHolder value:initialString.
+ patternHolder value:initialString.
].
fwd := true.
doSearch := [:fwd |
- |isVariableSearch pattern searchAction|
-
- self resetVariablesBeforeNewSearch.
-
- isVariableSearch := self searchVariableVisible
- and:[searchVariableHolder value
- and:[selectedVariable notNil]].
-
- isVariableSearch ifTrue:[
- searchAction :=
- [
- self searchVariableWithSyntaxElement:selectedVariable forward:fwd
- ].
- ] ifFalse:[
- lastSearchWasVariableSearch := false.
- LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
- LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
- LastSearchWasMatchWithRegex := matchWithRegexHolder value.
- LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
- LastSearchWasReplace :=replaceBooleanHolder value.
- LastSearchReplacedString := replaceTextHolder value.
-
- pattern := patternHolder value.
- pattern notEmptyOrNil ifTrue:[
- searchAction :=
- [
- self searchUsingSpec:(
- self class searchSpec new
- pattern:pattern
- ignoreCase:lastSearchIgnoredCase
- match: lastSearchWasMatch
- regexMatch:matchWithRegexHolder value
- variable: searchVariableHolder value
- fullWord: searchFullWordHolder value
- forward:fwd
- atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
- wrapAtEnd:wrapAtEndHolder value).
- ]
- ]
- ].
-
- replaceBooleanHolder value ifTrue:[
- |selStart replacement replaceAction|
-
- replacement := replaceTextHolder value.
- isVariableSearch ifTrue:[
- "/ must replace from the end towards beginning,
- "/ because syntax-elements do not update their position, when
- "/ the text is changed (in replace).
-
- selectedVariable := selectedVariable lastElementInChain.
- self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
- searchAction :=
- [
- selectedVariable := selectedVariable previousElement.
- selectedVariable notNil ifTrue:[
- self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
- ].
- "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
- ].
- ].
-
- replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
- replacePreserveCaseBooleanHolder value ifTrue:[
- replaceAction := [
- self selectionAsString isUppercaseFirst ifTrue:[
- self replace:replacement asUppercaseFirst
- ] ifFalse:[
- self replace:replacement asLowercaseFirst
- ]
- ].
- ].
-
- selStart := self characterPositionOfSelection.
-
- replaceAction value.
- searchAction value.
-
- replaceAllBooleanHolder value ifTrue:[
- [self characterPositionOfSelection ~= selStart] whileTrue:[
- selStart := self characterPositionOfSelection.
- replaceAction value.
- searchAction value.
- ]
- ]
- ] ifFalse:[
- searchAction value.
- ].
+ |isVariableSearch pattern searchAction|
+
+ self resetVariablesBeforeNewSearch.
+
+ isVariableSearch := self searchVariableVisible
+ and:[searchVariableHolder value
+ and:[selectedVariable notNil]].
+
+ isVariableSearch ifTrue:[
+ searchAction :=
+ [
+ self searchVariableWithSyntaxElement:selectedVariable forward:fwd
+ ].
+ ] ifFalse:[
+ lastSearchWasVariableSearch := false.
+ LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
+ LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
+ LastSearchWasMatchWithRegex := matchWithRegexHolder value.
+ LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
+ LastSearchWasReplace :=replaceBooleanHolder value.
+ LastSearchReplacedString := replaceTextHolder value.
+
+ pattern := patternHolder value.
+ pattern notEmptyOrNil ifTrue:[
+ searchAction :=
+ [
+ self searchUsingSpec:(
+ self class searchSpec new
+ pattern:pattern
+ ignoreCase:lastSearchIgnoredCase
+ match: lastSearchWasMatch
+ regexMatch:matchWithRegexHolder value
+ variable: searchVariableHolder value
+ fullWord: searchFullWordHolder value
+ forward:fwd
+ atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
+ wrapAtEnd:wrapAtEndHolder value).
+ ]
+ ]
+ ].
+
+ replaceBooleanHolder value ifTrue:[
+ |selStart replacement replaceAction|
+
+ replacement := replaceTextHolder value.
+ isVariableSearch ifTrue:[
+ "/ must replace from the end towards beginning,
+ "/ because syntax-elements do not update their position, when
+ "/ the text is changed (in replace).
+
+ selectedVariable := selectedVariable lastElementInChain.
+ self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
+ searchAction :=
+ [
+ selectedVariable := selectedVariable previousElement.
+ selectedVariable notNil ifTrue:[
+ self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop.
+ ].
+ "/ self searchVariableWithSyntaxElement:selectedVariable forward:false
+ ].
+ ].
+
+ replaceAction := [ self replace:replacement ]. "/ not implemented here, but in subclasses
+ replacePreserveCaseBooleanHolder value ifTrue:[
+ replaceAction := [
+ self selectionAsString isUppercaseFirst ifTrue:[
+ self replace:replacement asUppercaseFirst
+ ] ifFalse:[
+ self replace:replacement asLowercaseFirst
+ ]
+ ].
+ ].
+
+ selStart := self characterPositionOfSelection.
+
+ replaceAction value.
+ searchAction value.
+
+ replaceAllBooleanHolder value ifTrue:[
+ [self characterPositionOfSelection ~= selStart] whileTrue:[
+ selStart := self characterPositionOfSelection.
+ replaceAction value.
+ searchAction value.
+ ]
+ ]
+ ] ifFalse:[
+ searchAction value.
+ ].
].
bindings := IdentityDictionary new.
bindings at:#searchPattern put:patternHolder.
modal ifTrue:[
- bindings
- at:#nextAction
- put:[
- replaceAllBooleanHolder value ifTrue:[
- searchBox doAccept.
- ] ifFalse:[
- doSearch value:true
- ]
- ].
- bindings
- at:#prevAction
- put:[
- replaceAllBooleanHolder value ifTrue:[
- fwd := false. searchBox doAccept.
- ] ifFalse:[
- doSearch value:false
- ]
- ].
+ bindings
+ at:#nextAction
+ put:[
+ replaceAllBooleanHolder value ifTrue:[
+ searchBox doAccept.
+ ] ifFalse:[
+ doSearch value:true
+ ]
+ ].
+ bindings
+ at:#prevAction
+ put:[
+ replaceAllBooleanHolder value ifTrue:[
+ fwd := false. searchBox doAccept.
+ ] ifFalse:[
+ doSearch value:false
+ ]
+ ].
] ifFalse:[
- bindings at:#nextAction put:[doSearch value:true.].
- bindings at:#prevAction put:[doSearch value:false.].
+ bindings at:#nextAction put:[doSearch value:true.].
+ bindings at:#prevAction put:[doSearch value:false.].
].
bindings at:#caseSensitive put:caseHolder.
bindings at:#match put:matchHolder.
bindings at:#matchWithRegex put:matchWithRegexHolder.
Regex::RxMatcher isNil ifTrue:[
- bindings at:#matchWithRegexVisible put:false.
+ bindings at:#matchWithRegexVisible put:false.
] ifFalse:[
- bindings at:#matchWithRegexVisible put:matchHolder
+ bindings at:#matchWithRegexVisible put:matchHolder
].
bindings at:#patternList put:LastSearchPatterns.
self supportsSyntaxElements ifFalse:[
- bindings at:#searchVariableVisible put:false.
+ bindings at:#searchVariableVisible put:false.
] ifTrue:[
- bindings at:#searchVariableVisible put:true.
- selectedVariable := self syntaxElementForSelectedVariable.
- bindings at:#searchVariableEnabled put:(selectedVariable notNil).
- selectedVariable notNil ifTrue:[
- bindings
- at:#stringWithVariableUnderCursorHolder
- put:(resources string:'Variable ("%1")' with:selectedVariable name).
- "/ searchVariableHolder value:true.
- ] ifFalse:[
- bindings
- at:#stringWithVariableUnderCursorHolder
- put:(resources string:'Variable (none selected)').
- ].
+ bindings at:#searchVariableVisible put:true.
+ selectedVariable := self syntaxElementForSelectedVariable.
+ bindings at:#searchVariableEnabled put:(selectedVariable notNil).
+ selectedVariable notNil ifTrue:[
+ bindings
+ at:#stringWithVariableUnderCursorHolder
+ put:(resources string:'Variable ("%1")' with:selectedVariable name).
+ "/ searchVariableHolder value:true.
+ ] ifFalse:[
+ bindings
+ at:#stringWithVariableUnderCursorHolder
+ put:(resources string:'Variable (none selected)').
+ ].
].
bindings at:#searchVariable put:searchVariableHolder.
@@ -2451,7 +2453,7 @@
bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
bindings at:#selectLinesHolder put:selectLinesHolder.
-
+
bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
bindings at:#replaceBoolean put:replaceBooleanHolder.
bindings at:#replaceAllBoolean put:replaceAllBooleanHolder.
@@ -2459,39 +2461,39 @@
bindings at:#replaceTextHolder put:replaceTextHolder.
bindings at:#flyByHelpSpec put:self class flyByHelpSpec.
-
+
updateReturnKeyBehavior :=
- [
- |lbl returnAction|
-
- "/ when replacing, do not close box on return
- replaceBooleanHolder value ifTrue:[
- lbl := 'Close'.
- returnAction := searchAction.
- ] ifFalse:[
- lbl := 'Cancel'.
- returnAction := nil.
- ].
- (bldr componentAt:#cancelButton) label:(resources string:lbl).
- searchBox window keyboardProcessor returnAction:returnAction.
- ].
-
+ [
+ |lbl returnAction|
+
+ "/ when replacing, do not close box on return
+ replaceBooleanHolder value ifTrue:[
+ lbl := 'Close'.
+ returnAction := searchAction.
+ ] ifFalse:[
+ lbl := 'Cancel'.
+ returnAction := nil.
+ ].
+ (bldr componentAt:#cancelButton) label:(resources string:lbl).
+ searchBox window keyboardProcessor returnAction:returnAction.
+ ].
+
replaceBooleanHolder onChangeEvaluate:
- [
- replaceBooleanHolder value ifTrue:[
- (bldr componentAt:#ReplaceEntryField) requestFocus
- ] ifFalse:[
- (bldr componentAt:#patternComboBox) requestFocus
- ].
- updateReturnKeyBehavior value.
- ].
+ [
+ replaceBooleanHolder value ifTrue:[
+ (bldr componentAt:#ReplaceEntryField) requestFocus
+ ] ifFalse:[
+ (bldr componentAt:#patternComboBox) requestFocus
+ ].
+ updateReturnKeyBehavior value.
+ ].
modal ifTrue:[
- searchBox := SimpleDialog new.
+ searchBox := SimpleDialog new.
] ifFalse:[
- searchBox := ApplicationModel new.
- searchBox createBuilder.
- bindings at:#cancel put:[ searchBox closeRequest ].
+ searchBox := ApplicationModel new.
+ searchBox createBuilder.
+ bindings at:#cancel put:[ searchBox closeRequest ].
].
searchBox resources:(self resources).
@@ -2505,26 +2507,26 @@
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
modal ifTrue:[
- updateReturnKeyBehavior value.
- searchBox openDialogAtPointer.
- searchBox accepted ifTrue:[ doSearch value:fwd ].
+ updateReturnKeyBehavior value.
+ searchBox openDialogAtPointer.
+ searchBox accepted ifTrue:[ doSearch value:fwd ].
] ifFalse:[
- (bldr componentAt:#nextButton) isReturnButton:false.
- (bldr componentAt:#cancelButton)
- label:(resources string:'Close');
- action:[searchBox closeRequest].
- "/ searchBox masterApplication:self application.
- self topView beMaster.
- searchBox window
- beSlave;
- openInGroup:(self windowGroup);
- waitUntilVisible;
- assignKeyboardFocusToFirstKeyboardConsumer.
- searchBox window keyboardProcessor
- addAccelerator:#Return action:(bindings at:#nextAction);
- addAccelerator:#Escape action:#closeRequest.
- "/ remember this box for me.
- self objectAttributeAt:#currentModelessSearchBox put:searchBox.
+ (bldr componentAt:#nextButton) isReturnButton:false.
+ (bldr componentAt:#cancelButton)
+ label:(resources string:'Close');
+ action:[searchBox closeRequest].
+ "/ searchBox masterApplication:self application.
+ self topView beMaster.
+ searchBox window
+ beSlave;
+ openInGroup:(self windowGroup);
+ waitUntilVisible;
+ assignKeyboardFocusToFirstKeyboardConsumer.
+ searchBox window keyboardProcessor
+ addAccelerator:#Return action:(bindings at:#nextAction);
+ addAccelerator:#Escape action:#closeRequest.
+ "/ remember this box for me.
+ self objectAttributeAt:#currentModelessSearchBox put:searchBox.
]
"Modified: / 11-07-2006 / 11:18:38 / fm"
@@ -2582,40 +2584,40 @@
filename := aFilename asFilename.
self withWriteCursorDo:[
- |aStream|
-
- (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
- msg := resources
- stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
- with:filename name.
- ] ifTrue:[
- [
- doAppend ifTrue:[
- aStream := filename appendingWriteStream.
- ] ifFalse:[
- UserPreferences current generateBackupFileWhenSaving ifTrue:[
- filename exists ifTrue:[
- filename moveTo:(filename pathName,'.bak') asFilename
- ].
- ].
- aStream := filename newReadWriteStream.
- ].
- aStream eolMode:eolMode.
- self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
- aStream syncData; close.
- contentsWasSaved := true.
- defaultFileNameForFileDialog := filename.
- ] on:FileStream openErrorSignal do:[:ex|
- msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
- with:filename name
- with:FileStream lastErrorString.
- ].
- ].
+ |aStream|
+
+ (FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
+ msg := resources
+ stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)'
+ with:filename name.
+ ] ifTrue:[
+ [
+ doAppend ifTrue:[
+ aStream := filename appendingWriteStream.
+ ] ifFalse:[
+ UserPreferences current generateBackupFileWhenSaving ifTrue:[
+ filename exists ifTrue:[
+ filename moveTo:(filename pathName,'.bak') asFilename
+ ].
+ ].
+ aStream := filename newReadWriteStream.
+ ].
+ aStream eolMode:eolMode.
+ self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding.
+ aStream syncData; close.
+ contentsWasSaved := true.
+ defaultFileNameForFileDialog := filename.
+ ] on:FileStream openErrorSignal do:[:ex|
+ msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)'
+ with:filename name
+ with:FileStream lastErrorString.
+ ].
+ ].
].
msg notNil ifTrue:[
- Dialog warn:msg.
- ^ false
+ Dialog warn:msg.
+ ^ false
].
^ true
@@ -2735,7 +2737,7 @@
!TextView methodsFor:'native widget support'!
nativeWindowType
- "return a symbol describing my native window type
+ "return a symbol describing my native window type
(may be used internally by the device as a native window creation hint,
if the device supports native windows)"
@@ -2782,56 +2784,56 @@
"/ This is now obsolete, as we are always using unicode internally.
"/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
- encoder := CharacterEncoder encoderToEncodeFrom:characterEncoding into:encodingSymOrNil.
+ encoder := CharacterEncoder encoderToEncodeFrom:gc characterEncoding into:encodingSymOrNil.
encoder isNullEncoder ifTrue:[
- (list contains:[:lineOrNil|
- |s|
- lineOrNil notNil
- and:[(s := lineOrNil string string) isWideString
- and:[s asSingleByteStringIfPossible isWideString]]
- ]
- ) ifTrue:[
- (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
- ^ self
- ]
- ].
- encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
+ (list contains:[:lineOrNil|
+ |s|
+ lineOrNil notNil
+ and:[(s := lineOrNil string string) isWideString
+ and:[s asSingleByteStringIfPossible isWideString]]
+ ]
+ ) ifTrue:[
+ (Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[
+ ^ self
+ ]
+ ].
+ encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8
].
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.
- (aStream eolMode notNil
- and:[aStream eolMode ~= #nl]) ifTrue:[
- "/ must do it lineWise ...
- list do:[:line |
- line notNil ifTrue:[
- encoder encodeString:line withTabs on:aStream
- ].
- aStream cr
- ].
- ] ifFalse:[
- [startNr <= nLines] whileTrue:[
- string := list
- asStringWithCRsFrom:startNr
- to:((startNr + 1000) min:nLines)
- compressTabs:compressTabs.
- encoder encodeString:string string on:aStream.
- startNr := startNr + 1000 + 1.
- ].
- ].
+ "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.
+ (aStream eolMode notNil
+ and:[aStream eolMode ~= #nl]) ifTrue:[
+ "/ must do it lineWise ...
+ list do:[:line |
+ line notNil ifTrue:[
+ encoder encodeString:line withTabs on:aStream
+ ].
+ aStream cr
+ ].
+ ] ifFalse:[
+ [startNr <= nLines] whileTrue:[
+ string := list
+ asStringWithCRsFrom:startNr
+ to:((startNr + 1000) min:nLines)
+ compressTabs:compressTabs.
+ encoder encodeString:string string on:aStream.
+ startNr := startNr + 1000 + 1.
+ ].
+ ].
] ifFalse:[
- list do:[:aLine |
- aLine notNil ifTrue:[
- encoder encodeString:aLine on:aStream.
- ].
- aStream cr.
- ]
+ list do:[:aLine |
+ aLine notNil ifTrue:[
+ encoder encodeString:aLine on:aStream.
+ ].
+ aStream cr.
+ ]
]
"Modified: 8.6.1996 / 11:50:46 / cg"
@@ -2843,9 +2845,9 @@
line separation. This is required, to allow for proper handling of
national characters, such as A-diaresis ..."
- |italicFont boldFont|
-
- font := font onDevice:device.
+ |italicFont boldFont font|
+
+ font := gc createFontOnDevice.
"/ do we really need this info now?
"/ on unix, it seems to work with the next two lines commented;
"/ should probably check on windows too
@@ -2853,25 +2855,25 @@
boldFont := font asBold onDevice:device.
fontHeight := font height.
- fontAscent := font ascent.
+ fontAscent := font ascent.
fontWidth := font width.
fontIsFixedWidth := font isFixedWidth.
- "/ fA := font maxAscent.
- italicFont notNil ifTrue:[
- fontHeight := fontHeight max:(italicFont height).
- fontAscent := fontAscent max:(italicFont ascent).
- fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
- ].
- boldFont notNil ifTrue:[
- fontHeight := fontHeight max:(boldFont height).
- fontAscent := fontAscent max:(boldFont ascent).
- fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
- ].
+ "/ fA := font maxAscent.
+ italicFont notNil ifTrue:[
+ fontHeight := fontHeight max:(italicFont height).
+ fontAscent := fontAscent max:(italicFont ascent).
+ fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
+ ].
+ boldFont notNil ifTrue:[
+ fontHeight := fontHeight max:(boldFont height).
+ fontAscent := fontAscent max:(boldFont ascent).
+ fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
+ ].
includesNonStrings == true ifTrue:[
- "/ for now, we do not support variable height entries ...
- fontHeight := fontHeight max:(list first heightOn:self).
+ "/ for now, we do not support variable height entries ...
+ fontHeight := fontHeight max:(list first heightOn:self).
].
fontHeight := fontHeight + lineSpacing.
@@ -2959,7 +2961,7 @@
selectionEndLine := firstLineShown + nFullLinesShown.
selectionEndCol := 0.
prevEndLine to:selectionEndLine do:[:lineNr |
- self redrawLine:lineNr
+ self redrawLine:lineNr
].
autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
self selectionChanged.
@@ -2997,11 +2999,11 @@
endLine := self listLineToVisibleLine:selectionEndLine.
endLine notNil ifTrue:[
- firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
- selectionEndCol < firstVisibleCol ifTrue:[
- "/ scrolling faster than selection advances...
- selectionEndCol := firstVisibleCol
- ].
+ firstVisibleCol := self colOfX:1 inVisibleLine:endLine.
+ selectionEndCol < firstVisibleCol ifTrue:[
+ "/ scrolling faster than selection advances...
+ selectionEndCol := firstVisibleCol
+ ].
].
self selectionChanged.
@@ -3028,7 +3030,7 @@
selectionStartLine := firstLineShown.
selectionStartCol := 1.
selectionStartLine to:prevStartLine do:[:lineNr |
- self redrawLine:lineNr
+ self redrawLine:lineNr
].
autoScrollBlock notNil ifTrue:[ Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT ].
self selectionChanged.
@@ -3047,9 +3049,9 @@
textChanged
self isNativeWidget ifTrue:[
- gc drawableId notNil ifTrue:[
- device changeText:self contents in:gc drawableId
- ]
+ gc drawableId notNil ifTrue:[
+ device changeText:self contents in:gc drawableId
+ ]
].
super textChanged
!
@@ -3093,13 +3095,13 @@
"if there is a margin, clear it - a helper for selection drawing"
(leftMargin ~~ 0) ifTrue:[
- viewOrigin x <= margin ifTrue:[
- self paint:color.
- self fillRectangleX:margin-viewOrigin x
- y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
- width:leftMargin
- height:fontHeight
- ]
+ viewOrigin x <= margin ifTrue:[
+ self paint:color.
+ self fillRectangleX:margin-viewOrigin x
+ y:(self yOfVisibleLine:visLine)- (lineSpacing//2)
+ width:leftMargin
+ height:fontHeight
+ ]
]
"Created: 6.3.1996 / 14:22:55 / cg"
@@ -3236,50 +3238,50 @@
(selectionStartLine notNil and:[selectionEndLine notNil
and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
- line := self visibleLineToAbsoluteLine:visLineNr.
- (line between:selectionStartLine and:selectionEndLine) ifTrue:[
- (line == selectionStartLine) ifTrue:[
- (line == selectionEndLine) ifTrue:[
- "it's part-of-single-line selection"
- self clearMarginOfVisibleLine:visLineNr with:bgColor.
- (selectionStartCol > 1) ifTrue:[
- super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
- ].
- self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
- super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
- ^ self
- ].
-
- "it's the first line of a multi-line selection"
- (selectionStartCol ~~ 1) ifTrue:[
- self clearMarginOfVisibleLine:visLineNr with:bgColor.
- super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
- ] ifFalse:[
- viewOrigin x == 0 ifTrue:[
- self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
- ]
- ].
- self drawVisibleLineSelected:visLineNr from:selectionStartCol.
- ^ self
- ].
-
- (line == selectionEndLine) ifTrue:[
- "it's the last line of a multi-line selection"
- (selectionEndCol == 0) ifTrue:[
- ^ super redrawVisibleLine:visLineNr
- ].
-
- self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
- self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
- super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
- ^ self
- ].
-
- "it's a full line in a multi-line selection"
- self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
- self drawVisibleLineSelected:visLineNr.
- ^ self
- ]
+ line := self visibleLineToAbsoluteLine:visLineNr.
+ (line between:selectionStartLine and:selectionEndLine) ifTrue:[
+ (line == selectionStartLine) ifTrue:[
+ (line == selectionEndLine) ifTrue:[
+ "it's part-of-single-line selection"
+ self clearMarginOfVisibleLine:visLineNr with:bgColor.
+ (selectionStartCol > 1) ifTrue:[
+ super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
+ ].
+ self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
+ super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
+ ^ self
+ ].
+
+ "it's the first line of a multi-line selection"
+ (selectionStartCol ~~ 1) ifTrue:[
+ self clearMarginOfVisibleLine:visLineNr with:bgColor.
+ super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
+ ] ifFalse:[
+ viewOrigin x == 0 ifTrue:[
+ self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+ ]
+ ].
+ self drawVisibleLineSelected:visLineNr from:selectionStartCol.
+ ^ self
+ ].
+
+ (line == selectionEndLine) ifTrue:[
+ "it's the last line of a multi-line selection"
+ (selectionEndCol == 0) ifTrue:[
+ ^ super redrawVisibleLine:visLineNr
+ ].
+
+ self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+ self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
+ super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
+ ^ self
+ ].
+
+ "it's a full line in a multi-line selection"
+ self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
+ self drawVisibleLineSelected:visLineNr.
+ ^ self
+ ]
].
super redrawVisibleLine:visLineNr
@@ -3296,18 +3298,18 @@
"/
(selectionStartLine notNil and:[selectionEndLine notNil
and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[
- line := self visibleLineToAbsoluteLine:visLine.
- (line between:selectionStartLine and:selectionEndLine) ifTrue:[
- ((line == selectionStartLine)
- and: [col < selectionStartCol]) ifFalse:[
- ((line == selectionEndLine)
- and: [col > selectionEndCol]) ifFalse:[
- "its in the selection"
- self drawVisibleLineSelected:visLine col:col.
- ^ self.
- ]
- ]
- ]
+ line := self visibleLineToAbsoluteLine:visLine.
+ (line between:selectionStartLine and:selectionEndLine) ifTrue:[
+ ((line == selectionStartLine)
+ and: [col < selectionStartCol]) ifFalse:[
+ ((line == selectionEndLine)
+ and: [col > selectionEndCol]) ifFalse:[
+ "its in the selection"
+ self drawVisibleLineSelected:visLine col:col.
+ ^ self.
+ ]
+ ]
+ ]
].
self drawVisibleLine:visLine col:col with:fgColor and:bgColor
@@ -3354,75 +3356,75 @@
allOut := false.
(selectionStartLine isNil or:[selectionEndLine isNil
or:[selectionStartCol isNil or:[selectionEndCol 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 drawVisibleLineSelected:visLine from:startCol to:endCol
+ self drawVisibleLineSelected:visLine from:startCol to:endCol
] 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 drawVisibleLineSelected:visLine from:leftCol to:rightCol.
-
- "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 drawVisibleLineSelected:visLine from:leftCol to:rightCol.
+
+ "redraw part after selection"
+ (rightCol < endCol) ifTrue:[
+ super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
+ ]
].
"special care for first and last line of selection:
@@ -3432,14 +3434,14 @@
and:[(startCol == 1)
and:[selectionStartLine < selectionEndLine]])
ifTrue:[
- self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
+ self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
].
((line == selectionStartLine)
and:[(startCol == 1)
and:[selectionStartLine < selectionEndLine]])
ifTrue:[
- self clearMarginOfVisibleLine:visLine with:bgColor.
+ self clearMarginOfVisibleLine:visLine with:bgColor.
].
((line > selectionStartLine)
@@ -3447,7 +3449,7 @@
and:[selectionStartLine < selectionEndLine
and:[line < selectionEndLine]]])
ifTrue:[
- self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
+ self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
]
"Modified: 6.3.1996 / 14:23:26 / cg"
@@ -3691,12 +3693,12 @@
startCol := pos x.
self
- searchBackwardUsingSpec:searchSpec
- startingAtLine:startLine col:startCol
- ifFound:[:line :col :endColOrNil|
- self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
- ]
- ifAbsent:aBlock
+ searchBackwardUsingSpec:searchSpec
+ startingAtLine:startLine col:startCol
+ ifFound:[:line :col :endColOrNil|
+ self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
+ ]
+ ifAbsent:aBlock
!
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
@@ -4434,12 +4436,12 @@
"do a forward search"
self
- searchForwardUsingSpec:searchSpec
- startingAtLine:startLine col:startCol
- ifFound:[:line :col :endColOrNil|
- self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
- ]
- ifAbsent:aBlock
+ searchForwardUsingSpec:searchSpec
+ startingAtLine:startLine col:startCol
+ ifFound:[:line :col :endColOrNil|
+ self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
+ ]
+ ifAbsent:aBlock
!
searchPattern
@@ -4454,36 +4456,36 @@
a language aware search (as opposed to a naive string search)"
self
- searchUsingSearchAction:direction
- ifAbsent:[
- self sensor compressKeyPressEventsWithKey:#FindNext.
- self showNotFound
- ]
+ searchUsingSearchAction:direction
+ ifAbsent:[
+ self sensor compressKeyPressEventsWithKey:#FindNext.
+ self showNotFound
+ ]
!
searchUsingSearchAction:direction ifAbsent:notFoundAction
"search using a searchaction which has been given by someone else.
Typically, this is the embedding browser, which has provided an action for
a language aware search (as opposed to a naive string search)"
-
+
|pos startLine startCol|
pos := direction == #backward
- ifTrue:[self startPositionForSearchBackward]
- ifFalse:[self startPositionForSearchForward].
+ ifTrue:[self startPositionForSearchBackward]
+ ifFalse:[self startPositionForSearchForward].
startLine := pos y.
startCol := pos x.
searchAction notNil ifTrue:[
- searchAction
- value:direction
- value:startLine
- value:startCol
- value:[:line :col | self selectFromLine:line toLine:line]
- value:notFoundAction.
- self hasSelection ifTrue: [
- self changeTypeOfSelectionTo: #searchAction.
- ].
+ searchAction
+ value:direction
+ value:startLine
+ value:startCol
+ value:[:line :col | self selectFromLine:line toLine:line]
+ value:notFoundAction.
+ self hasSelection ifTrue: [
+ self changeTypeOfSelectionTo: #searchAction.
+ ].
].
!
@@ -4497,10 +4499,10 @@
"set the searchpattern for future searches"
aStringOrNil isEmptyOrNil ifTrue:[
- lastSearchPattern := nil.
+ lastSearchPattern := nil.
] ifFalse:[
- "/ not withoutSeparators: may want to search for spaces...
- lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
+ "/ not withoutSeparators: may want to search for spaces...
+ lastSearchPattern := aStringOrNil asString "withoutSeparators" string.
].
"Modified: / 6.3.1999 / 23:47:36 / cg"
@@ -4562,17 +4564,17 @@
|endCol realPattern|
(endCol := encColOrNil) isNil ifTrue:[
- "/ a hack.
- realPattern := pattern.
- isMatch ifTrue: [
- (realPattern startsWith:$*) ifTrue:[
- realPattern := realPattern copyButFirst
- ].
- (realPattern endsWith:$*) ifTrue:[
- realPattern := realPattern copyButLast
- ].
- ].
- endCol := (col + realPattern size - 1).
+ "/ a hack.
+ realPattern := pattern.
+ isMatch ifTrue: [
+ (realPattern startsWith:$*) ifTrue:[
+ realPattern := realPattern copyButFirst
+ ].
+ (realPattern endsWith:$*) ifTrue:[
+ realPattern := realPattern copyButLast
+ ].
+ ].
+ endCol := (col + realPattern size - 1).
].
self selectFromLine:line col:col toLine:line col:endCol.
@@ -4585,8 +4587,8 @@
(used to be: tell user by changing cursor for a while)"
self withCursor:(Cursor cross) do:[
- self beep.
- Processor activeProcess millisecondDelay:200.
+ self beep.
+ Processor activeProcess millisecondDelay:200.
]
"Modified: 20.2.1997 / 12:49:27 / cg"
@@ -4639,31 +4641,31 @@
|l t|
selectionStartLine notNil ifTrue:[
- expandingTop == true 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.
- ].
+ expandingTop == true 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 validateNewSelection.
- self setPrimarySelection.
- self selectionChanged.
- self redrawFromLine:l to:l+1.
- self makeSelectionVisible.
+ self validateNewSelection.
+ self setPrimarySelection.
+ self selectionChanged.
+ self redrawFromLine:l to:l+1.
+ self makeSelectionVisible.
].
"Created: / 01-03-1996 / 23:35:08 / cg"
@@ -4675,34 +4677,34 @@
|c l t c1 c2|
selectionStartLine notNil ifTrue:[
- expandingTop == true 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 validateNewSelection.
- self setPrimarySelection.
- self selectionChanged.
- self redrawLine:l from:c1 to:c2.
- self makeSelectionVisible.
+ expandingTop == true 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 validateNewSelection.
+ self setPrimarySelection.
+ self selectionChanged.
+ self redrawLine:l from:c1 to:c2.
+ self makeSelectionVisible.
].
"Modified: / 18-03-1996 / 17:05:46 / cg"
@@ -4713,29 +4715,29 @@
|l c t|
selectionStartLine notNil ifTrue:[
- expandingTop == true 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 validateNewSelection.
- self setPrimarySelection.
- self selectionChanged.
- self redrawLine:l from:(c max:1) to:c+1.
- self makeSelectionVisible.
+ expandingTop == true 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 validateNewSelection.
+ self setPrimarySelection.
+ self selectionChanged.
+ self redrawLine:l from:(c max:1) to:c+1.
+ self makeSelectionVisible.
].
"Created: / 01-03-1996 / 23:33:17 / cg"
@@ -4747,33 +4749,33 @@
|l t|
selectionStartLine notNil ifTrue:[
- expandingTop == true 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 validateNewSelection.
- self setPrimarySelection.
- self selectionChanged.
- "/ self redrawLine:l.
- "/ self redrawLine:l+1.
- self redrawFromLine:l to:l+1.
- self makeSelectionVisible.
+ expandingTop == true 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 validateNewSelection.
+ self setPrimarySelection.
+ self selectionChanged.
+ "/ self redrawLine:l.
+ "/ self redrawLine:l+1.
+ self redrawFromLine:l to:l+1.
+ self makeSelectionVisible.
].
"Modified: / 06-03-1996 / 14:12:06 / cg"
@@ -4803,9 +4805,9 @@
!
hasSingleFullLineSelected
- ^ (selectionStartLine notNil
+ ^ (selectionStartLine notNil
and:[selectionEndLine notNil
- and:[selectionEndLine == (selectionStartLine+1)
+ and:[selectionEndLine == (selectionStartLine+1)
and:[selectionStartCol == 1
and:[selectionEndCol == 0
]]]])
@@ -4876,7 +4878,7 @@
|line1 col1 line2 col2|
pos1 > pos2 ifTrue:[
- ^ self unselect
+ ^ self unselect
].
line1 := self lineOfCharacterPosition:pos1.
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
@@ -4898,37 +4900,37 @@
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.
- self setPrimarySelection.
- self selectionChanged.
-
- (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.
+ self setPrimarySelection.
+ self selectionChanged.
+
+ (selectionStartLine == selectionEndLine) ifTrue:[
+ self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
+ ] ifFalse:[
+ selectionStartLine to:selectionEndLine do:[:lineNr |
+ self redrawLine:lineNr
+ ]
+ ].
+ selectStyle := nil.
]
"
@@ -5044,11 +5046,11 @@
selectionStartLine isNil ifTrue:[^ nil].
sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol.
sel notEmptyOrNil ifTrue:[
- "/ this is rubbish; we are now always using unicode internally
- "/ any many more conversions would be needed at many places...
- (characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
- sel := sel encodeFrom:characterEncoding into:#'iso10646-1'
- ].
+ "/ this is rubbish; we are now always using unicode internally
+ "/ any many more conversions would be needed at many places...
+ (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
+ sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
+ ].
].
^ sel
@@ -5188,18 +5190,18 @@
expandingTop := true. "/ hack to make the top of the selection visible
self makeSelectionVisible.
selectionStartLine notNil ifTrue:[
- selectionEndLine notNil ifTrue:[
- self redrawFromLine:selectionStartLine to:selectionEndLine.
- ].
+ selectionEndLine notNil ifTrue:[
+ self redrawFromLine:selectionStartLine to:selectionEndLine.
+ ].
].
self flush.
aBlock ensure:[
- "
- undo selection color change and show cursor again
- "
- selectionFgColor := oldFg.
- selectionBgColor := oldBg.
+ "
+ undo selection color change and show cursor again
+ "
+ selectionFgColor := oldFg.
+ selectionBgColor := oldBg.
].
! !