--- a/TextView.st Wed Jul 20 10:11:27 2016 +0200
+++ b/TextView.st Wed Jul 20 10:13:44 2016 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -16,26 +16,26 @@
"{ NameSpace: Smalltalk }"
ListView subclass:#TextView
- instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
- selectionEndCol clickPos clickStartLine clickStartCol clickLine
- clickCol clickCount expandingTop wordStartCol wordStartLine
- wordEndCol wordEndLine selectionFgColor selectionBgColor
- selectStyle directoryForFileDialog defaultFileNameForFileDialog
- externalEncoding contentsWasSaved searchAction lastSearchPattern
- lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
- lastSearchWasVariableSearch parenthesisSpecification dropSource
- dragIsActive saveAction st80SelectMode searchBarActionBlock'
- classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
- DefaultSelectionBackgroundColor
- DefaultAlternativeSelectionForegroundColor
- DefaultAlternativeSelectionBackgroundColor MatchDelayTime
- WordSelectCatchesBlanks LastSearchPatterns
- NumRememberedSearchPatterns LastSearchIgnoredCase
- LastSearchWasMatch DefaultParenthesisSpecification
- LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
- LastSearchWasReplace LastSearchReplacedString'
- poolDictionaries:''
- category:'Views-Text'
+ instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
+ selectionEndCol clickPos clickStartLine clickStartCol clickLine
+ clickCol clickCount expandingTop wordStartCol wordStartLine
+ wordEndCol wordEndLine selectionFgColor selectionBgColor
+ selectStyle directoryForFileDialog defaultFileNameForFileDialog
+ externalEncoding contentsWasSaved searchAction lastSearchPattern
+ lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
+ lastSearchWasVariableSearch parenthesisSpecification dropSource
+ dragIsActive saveAction st80SelectMode searchBarActionBlock'
+ classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
+ DefaultSelectionBackgroundColor
+ DefaultAlternativeSelectionForegroundColor
+ DefaultAlternativeSelectionBackgroundColor MatchDelayTime
+ WordSelectCatchesBlanks LastSearchPatterns
+ NumRememberedSearchPatterns LastSearchIgnoredCase
+ LastSearchWasMatch DefaultParenthesisSpecification
+ LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
+ LastSearchWasReplace LastSearchReplacedString'
+ poolDictionaries:''
+ category:'Views-Text'
!
!TextView class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -86,27 +86,27 @@
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)
dropSource <DropSource> drag operation descriptor or nil (dragging disabled)
dragIsActive <Boolean> true, drag operation is activated
searchAction <Block> an autosearch action; typically set by the browser.
- Will be used as default when searchFwd/searchBwd is
- pressed. If the searchPattern is changed, no autosearch
- action will be executed.
+ Will be used as default when searchFwd/searchBwd is
+ pressed. If the searchPattern is changed, no autosearch
+ action will be executed.
searchBarActionBlock <Block> search action block for embedded search
- panel. Used as second chance for searchFwd/bwd
+ panel. Used as second chance for searchFwd/bwd
[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:]
@@ -119,14 +119,14 @@
text.selectionBackgroundColor defaults to textForegroundColor
text.alternativeSelectionForegroundColor pasted text (i.e. paste will not replace)
- defaults to selectionForegroundColor
+ defaults to selectionForegroundColor
text.alternativeSelectionBackgroundColor pasted text (i.e. paste will not replace)
- defaults to selectionBackgroundColor
+ defaults to selectionBackgroundColor
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- EditTextView CodeView Workspace
+ EditTextView CodeView Workspace
"
!
@@ -137,18 +137,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:
@@ -159,26 +159,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]
"
@@ -190,28 +190,28 @@
"for ST-80 compatibility"
^ (self new)
- on:aModel
- aspect:aspect
- list:aspect
- change:change
- menu:menu
- initialSelection:initial
+ on:aModel
+ aspect:aspect
+ list:aspect
+ change:change
+ menu:menu
+ initialSelection:initial
!
with:someText
^ (self new)
- contents:someText
+ contents:someText
! !
!TextView class methodsFor:'class initialization'!
initialize
DefaultParenthesisSpecification isNil ifTrue:[
- DefaultParenthesisSpecification := IdentityDictionary new.
- DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") .
- DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<").
- DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
- DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters
+ DefaultParenthesisSpecification := IdentityDictionary new.
+ DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") .
+ DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<").
+ DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
+ DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters
].
! !
@@ -227,11 +227,11 @@
i := self classResources at:'ICON' default:nil.
i isNil ifTrue:[
- nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
- i := Smalltalk imageFromFileNamed:nm forClass:self.
+ nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
+ i := Smalltalk imageFromFileNamed:nm forClass:self.
].
i notNil ifTrue:[
- i := i onDevice:Display
+ i := i onDevice:Display
].
^ i
@@ -295,13 +295,13 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'textView.background'
- #'text.selectionForegroundColor'
- #'text.selectionBackgroundColor'
- #'text.alternativeSelectionForegroundColor'
- #'text.alternativeSelectionBackgroundColor'
- #'textView.font'
- #'text.wordSelectCatchesBlanks'
- #'text.st80Selections')>
+ #'text.selectionForegroundColor'
+ #'text.selectionBackgroundColor'
+ #'text.alternativeSelectionForegroundColor'
+ #'text.alternativeSelectionBackgroundColor'
+ #'textView.font'
+ #'text.wordSelectCatchesBlanks'
+ #'text.st80Selections')>
DefaultViewBackground := StyleSheet colorAt:'textView.background' default:Color white.
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
@@ -392,255 +392,255 @@
name: searchDialogSpec
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:
(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
+ )
+ )
)
)
@@ -786,9 +786,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
@@ -802,7 +802,7 @@
textView := self setupEmpty.
aFileName notNil ifTrue:[
- textView setupForFile:aFileName.
+ textView setupForFile:aFileName.
].
^ textView
@@ -833,7 +833,7 @@
aTitle notNil ifTrue:[top label:aTitle].
aStringOrStringCollection notNil ifTrue:[
- textView contents:aStringOrStringCollection
+ textView contents:aStringOrStringCollection
].
^ textView
@@ -897,7 +897,7 @@
selectionStartLine isNil ifTrue:[^ 0].
^ self characterPositionOfLine:selectionStartLine
- col:selectionStartCol
+ col:selectionStartCol
"Modified: 14.8.1997 / 16:35:37 / cg"
!
@@ -908,7 +908,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"
@@ -1012,11 +1012,11 @@
contents:newContents selected:selectedBoolean
self contents:newContents.
selectedBoolean ifTrue:[
- list size == 1 ifTrue:[
- self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
- ] ifFalse:[
- self selectAll
- ]
+ list size == 1 ifTrue:[
+ self selectFromLine:1 col:1 toLine:1 col:(list at:1) size
+ ] ifFalse:[
+ self selectAll
+ ]
]
"
@@ -1072,10 +1072,10 @@
super setContents:something.
selStartLine notNil ifTrue:[
- self
- selectFromLine:selStartLine col:selStartCol
- toLine:selEndLine col:selEndCol.
- selectStyle := selStyle
+ self
+ selectFromLine:selStartLine col:selStartCol
+ toLine:selEndLine col:selEndCol.
+ selectStyle := selStyle
].
@@ -1098,9 +1098,9 @@
self loadTextFile:aFileName.
aFileName notNil ifTrue:[
- baseName := aFileName asFilename baseName.
- self topView label:baseName.
- self defaultFileNameForFileDialog:baseName.
+ baseName := aFileName asFilename baseName.
+ self topView label:baseName.
+ self defaultFileNameForFileDialog:baseName.
].
"Created: / 25-10-2006 / 14:47:13 / cg"
@@ -1129,35 +1129,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 character 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"
! !
@@ -1184,7 +1184,7 @@
selectionFgColor := color1 onDevice:device.
selectionBgColor := color2 onDevice:device.
self hasSelection ifTrue:[
- self invalidate
+ self invalidate
]
"Modified: 29.5.1996 / 16:22:15 / cg"
@@ -1197,7 +1197,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].
@@ -1214,15 +1214,15 @@
"enable/disable dragging support
"
aBoolean ifFalse:[
- dropSource := nil.
+ dropSource := nil.
] ifTrue:[
- dropSource isNil ifTrue:[
- dropSource := DropSource
- receiver:self
- argument:nil
- dropObjectSelector:#collectionOfDragObjects
- displayObjectSelector:nil
- ]
+ dropSource isNil ifTrue:[
+ dropSource := DropSource
+ receiver:self
+ argument:nil
+ dropObjectSelector:#collectionOfDragObjects
+ displayObjectSelector:nil
+ ]
].
!
@@ -1345,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:[
@@ -1376,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.
@@ -1414,27 +1414,27 @@
"multi-mouse-click - select word under pointer"
(button == 1) ifTrue:[
- clickPos := x @ y.
-
- "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
+ clickPos := x @ y.
+
+ "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
"/ self clearSearchAction.
- 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"
@@ -1449,30 +1449,30 @@
sensor := self sensor.
(button == 1) ifTrue:[
- sensor shiftDown ifTrue:[
- "mouse-click with shift - adding to selection"
- self extendSelectionToX:x y:y.
- ^ self
- ].
-
- clickVisibleLine := self visibleLineOfY:y.
- clickPos := x @ y.
- clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
- clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
- clickStartLine := clickLine.
- clickStartCol := clickCol.
-
- (self canDrag
- and:[(self isInSelection:clickLine col:clickCol)
- and:[UserPreferences current startTextDragWithControl not
- or:[sensor ctrlDown]]]) ifTrue:[
- dragIsActive := true
- ] ifFalse:[
- self unselect.
- ].
- clickCount := 1
+ sensor shiftDown ifTrue:[
+ "mouse-click with shift - adding to selection"
+ self extendSelectionToX:x y:y.
+ ^ self
+ ].
+
+ clickVisibleLine := self visibleLineOfY:y.
+ clickPos := x @ y.
+ clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
+ clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
+ clickStartLine := clickLine.
+ clickStartCol := clickCol.
+
+ (self canDrag
+ and:[(self isInSelection:clickLine col:clickCol)
+ and:[UserPreferences current startTextDragWithControl not
+ or:[sensor ctrlDown]]]) ifTrue:[
+ dragIsActive := true
+ ] ifFalse:[
+ self unselect.
+ ].
+ clickCount := 1
] ifFalse:[
- super buttonPress:button x:x y:y
+ super buttonPress:button x:x y:y
]
"Modified: / 20.5.1999 / 17:02:45 / cg"
@@ -1482,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.
@@ -1517,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
+ ]
].
"
@@ -1672,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"
@@ -1703,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
@@ -1865,8 +1865,8 @@
"handle some keyboard input (there is not much to be done here)"
<resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
- #GotoLine #SelectAll #SaveAs #Print
- #'F*' #'f*' #ZoomIn #ZoomOut)>
+ #GotoLine #SelectAll #SaveAs #Print
+ #'F*' #'f*')>
(key == #Find) ifTrue:[self search. ^self].
(key == #Copy) ifTrue:[self copySelection. ^self].
@@ -1881,8 +1881,6 @@
(key == #SaveAs) ifTrue:[self save. ^self].
(key == #Print) ifTrue:[self doPrint. ^self].
- (key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ].
-
"
shift-Fn defines a key-sequence
Fn pastes that sequence
@@ -1891,14 +1889,14 @@
(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:[
- UserPreferences current 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:[
+ UserPreferences current functionKeySequences
+ at:key put:(self selection)
+ ].
+ ^ self
+ ].
].
super keyPress:key x:x y:y
@@ -1954,21 +1952,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"
@@ -1984,7 +1982,7 @@
lastSearchIgnoredCase := true.
parenthesisSpecification isNil ifTrue:[
- parenthesisSpecification := DefaultParenthesisSpecification.
+ parenthesisSpecification := DefaultParenthesisSpecification.
].
"I handle menus myself"
@@ -2008,22 +2006,22 @@
filename := aFileName asFilename.
(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[
- msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
- self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
- ^ self
+ msg := resources string:'Refused to append to file ''%1'' !!' with:filename name.
+ self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
+ ^ self
].
[
- aStream := filename appendingWriteStream.
- [
- self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
- ] ensure:[
- aStream close.
- ].
- contentsWasSaved := true
+ aStream := filename appendingWriteStream.
+ [
+ self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding.
+ ] ensure:[
+ aStream close.
+ ].
+ contentsWasSaved := true
] on:FileStream openErrorSignal do:[:ex|
- msg := resources string:'cannot append to file %1 !!' with:filename name.
- self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
+ msg := resources string:'cannot append to file %1 !!' with:filename name.
+ self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
]
"Modified: / 27-07-2012 / 09:41:18 / cg"
@@ -2035,28 +2033,28 @@
|newFont fp userPrefs fontPrefs newFontPrefs|
self withWaitCursorDo:[
- fp := FontPanel new.
- fp withChangeFontInViewsAllCheckBox:true.
- newFont := fp fontFromUserInitial:gc 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"
@@ -2069,11 +2067,11 @@
text := self selection.
text notNil ifTrue:[
- self unselect.
-
- "/ forget any emphasis ...
- text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
- self setClipboardText:text.
+ self unselect.
+
+ "/ forget any emphasis ...
+ text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
+ self setClipboardText:text.
]
"Modified: 17.5.1996 / 08:57:54 / cg"
@@ -2095,19 +2093,19 @@
list isNil ifTrue:[^ self].
self withWaitCursorDo:[
- printStream := Printer new.
- printStream supportsContext ifTrue:[
- printStream printerContext font:(self font).
- ].
-
- Printer writeErrorSignal handle:[:ex |
- self warn:('error while printing:\\'
- , ex description
- , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
- ] do:[
- self fileOutContentsOn:printStream.
- ].
- printStream close
+ printStream := Printer new.
+ printStream supportsContext ifTrue:[
+ printStream printerContext font:(self font).
+ ].
+
+ Printer writeErrorSignal handle:[:ex |
+ self warn:('error while printing:\\'
+ , ex description
+ , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
+ ] do:[
+ self fileOutContentsOn:printStream.
+ ].
+ printStream close
].
"Created: / 06-05-1996 / 16:11:26 / cg"
@@ -2123,21 +2121,21 @@
|items m|
items := #(
- ('Copy' copySelection Copy)
- ('-' nil )
- ('Search...' search Find)
- ('Goto Line...' gotoLine GotoLine)
- ('-' nil )
- ('Font...' changeFont )
- ('-' nil )
- ('Save As...' save SaveAs)
- ('Print' doPrint Print)
- ).
+ ('Copy' copySelection Copy)
+ ('-' nil )
+ ('Search...' search Find)
+ ('Goto Line...' gotoLine GotoLine)
+ ('-' nil )
+ ('Font...' changeFont )
+ ('-' nil )
+ ('Save As...' save SaveAs)
+ ('Print' doPrint Print)
+ ).
m := PopUpMenu itemList:items resources:resources.
self hasSelectionForCopy ifFalse:[
- m disable:#copySelection.
+ m disable:#copySelection.
].
^ m
@@ -2152,19 +2150,6 @@
"Created: 31.7.1997 / 19:13:58 / cg"
!
-fontLargerOrSmaller:largerBoolean
- |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"
- "Created: / 10-03-2012 / 09:38:32 / cg"
-!
-
gotoLine
"show a box to enter lineNumber for positioning;
The entered number may be prefixed by a + or -;
@@ -2173,41 +2158,41 @@
|l lineNumberBox input lineToGo relative|
lineNumberBox :=
- EnterBox
- title:(resources string:'Line number (or +/- relativeNr):')
- okText:(resources string:'Goto')
- abortText:(resources string:'Cancel')
- action:[:l | input := l].
+ EnterBox
+ title:(resources string:'Line number (or +/- relativeNr):')
+ 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 label:(resources string:'Goto Line').
lineNumberBox showAtPointer.
input size > 0 ifTrue:[
- input := input withoutSpaces.
- input size > 0 ifTrue:[
- (input startsWith:$+) ifTrue:[
- relative := 1.
- ] ifFalse:[
- (input startsWith:$-) ifTrue:[
- relative := -1.
- ].
- ].
- relative notNil ifTrue:[
- input := input copyFrom:2.
- ].
- lineToGo := Integer readFromString:input onError:nil.
- lineToGo notNil ifTrue:[
- relative notNil ifTrue:[
- lineToGo := self currentLine + (lineToGo * relative)
- ].
- self gotoLine:lineToGo
- ]
- ]
+ input := input withoutSpaces.
+ input size > 0 ifTrue:[
+ (input startsWith:$+) ifTrue:[
+ relative := 1.
+ ] ifFalse:[
+ (input startsWith:$-) ifTrue:[
+ relative := -1.
+ ].
+ ].
+ relative notNil ifTrue:[
+ input := input copyFrom:2.
+ ].
+ lineToGo := Integer readFromString:input onError:nil.
+ lineToGo notNil ifTrue:[
+ relative notNil ifTrue:[
+ lineToGo := self currentLine + (lineToGo * relative)
+ ].
+ self gotoLine:lineToGo
+ ]
+ ]
].
"Modified: / 17.5.1998 / 20:07:59 / cg"
@@ -2218,11 +2203,11 @@
and save contents into that file."
Dialog
- requestSaveFileName:(resources string:'Save contents in:')
- default:defaultFileNameForFileDialog
- fromDirectory:directoryForFileDialog
- action:[:fileName | self saveAs:fileName]
- appendAction:[:fileName | self appendTo:fileName]
+ requestSaveFileName:(resources string:'Save contents in:')
+ default:defaultFileNameForFileDialog
+ fromDirectory:directoryForFileDialog
+ action:[:fileName | self saveAs:fileName]
+ appendAction:[:fileName | self appendTo:fileName]
!
openSearchBoxAndSearch
@@ -2243,24 +2228,24 @@
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.
@@ -2285,166 +2270,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.
@@ -2463,37 +2448,37 @@
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).
@@ -2507,26 +2492,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"
@@ -2584,40 +2569,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
@@ -2645,16 +2630,16 @@
pattern := patternArg string.
pattern notEmpty ifTrue:[
- self rememberSearchPattern:pattern.
- "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
- "/ LastSearchWasMatch := match.
- fwd ifFalse:[
- lastSearchDirection := #backward.
- self searchBwd:pattern ignoreCase:ign match: match. " backward search with match is not yet available "
- ] ifTrue:[
- lastSearchDirection := #forward.
- self searchFwd:pattern ignoreCase:ign match: match.
- ]
+ self rememberSearchPattern:pattern.
+ "/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
+ "/ LastSearchWasMatch := match.
+ fwd ifFalse:[
+ lastSearchDirection := #backward.
+ self searchBwd:pattern ignoreCase:ign match: match. " backward search with match is not yet available "
+ ] ifTrue:[
+ lastSearchDirection := #forward.
+ self searchFwd:pattern ignoreCase:ign match: match.
+ ]
]
"Created: / 11-07-2006 / 11:18:04 / fm"
@@ -2666,11 +2651,11 @@
"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign.
"/ LastSearchWasMatch := match.
aSearchSpec forward ifFalse:[
- lastSearchDirection := #backward.
- self searchBwdUsingSpec:aSearchSpec
+ lastSearchDirection := #backward.
+ self searchBwdUsingSpec:aSearchSpec
] ifTrue:[
- lastSearchDirection := #forward.
- self searchFwdUsingSpec:aSearchSpec
+ lastSearchDirection := #forward.
+ self searchFwdUsingSpec:aSearchSpec
]
"Created: / 11-07-2006 / 11:18:04 / fm"
@@ -2694,25 +2679,25 @@
lastSearchWasVariableSearch := true.
el := fwd
- ifTrue:[syntaxElementForVariable nextElement]
- ifFalse:[syntaxElementForVariable previousElement].
+ ifTrue:[syntaxElementForVariable nextElement]
+ ifFalse:[syntaxElementForVariable previousElement].
el notNil ifTrue:[
- "bug workaround"
- (el start = syntaxElementForVariable start) ifTrue:[
- el2 := fwd
- ifTrue:[el nextElement]
- ifFalse:[el previousElement].
- el2 notNil ifTrue:[
- el := el2
- ]
- ].
+ "bug workaround"
+ (el start = syntaxElementForVariable start) ifTrue:[
+ el2 := fwd
+ ifTrue:[el nextElement]
+ ifFalse:[el previousElement].
+ el2 notNil ifTrue:[
+ el := el2
+ ]
+ ].
].
el notNil ifTrue:[
- self selectFromCharacterPosition:el start to:el stop.
- self makeLineVisible:(self lineOfCharacterPosition:el start).
+ self selectFromCharacterPosition:el start to:el stop.
+ self makeLineVisible:(self lineOfCharacterPosition:el start).
] ifFalse:[
- self showNotFound
+ self showNotFound
].
"Created: / 08-03-2012 / 14:08:20 / cg"
@@ -2760,8 +2745,8 @@
"save contents on a stream, replacing leading spaces by tab-characters."
self
- fileOutContentsOn:aStream
- compressTabs:true
+ fileOutContentsOn:aStream
+ compressTabs:true
!
fileOutContentsOn:aStream compressTabs:compressTabs
@@ -2769,9 +2754,9 @@
leading spaces will be replaced by tab-characters in the output."
self
- fileOutContentsOn:aStream
- compressTabs:compressTabs
- encoding:nil
+ fileOutContentsOn:aStream
+ compressTabs:compressTabs
+ encoding:nil
!
fileOutContentsOn:aStream compressTabs:compressTabs encoding:encodingSymOrNil
@@ -2786,54 +2771,54 @@
"/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
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"
@@ -2861,19 +2846,19 @@
"/ fA := font maxAscent.
italicFont notNil ifTrue:[
- fontHeight := fontHeight max:(italicFont height).
- fontAscent := fontAscent max:(italicFont ascent).
- fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
+ 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 ]
+ 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.
@@ -2913,15 +2898,15 @@
nRemembered := NumRememberedSearchPatterns ? 20.
LastSearchPatterns isNil ifTrue:[
- LastSearchPatterns := OrderedCollection new.
+ LastSearchPatterns := OrderedCollection new.
].
"/ move to top or addFirst
(LastSearchPatterns includes:patternString) ifTrue:[
- LastSearchPatterns remove:patternString.
+ LastSearchPatterns remove:patternString.
] ifFalse:[
- LastSearchPatterns size > nRemembered ifTrue:[
- LastSearchPatterns removeLast
- ]
+ LastSearchPatterns size > nRemembered ifTrue:[
+ LastSearchPatterns removeLast
+ ]
].
LastSearchPatterns addFirst:patternString.
@@ -2931,12 +2916,12 @@
removeTrailingWhitespace
list isNil ifTrue:[^self].
list keysAndValuesDo:[:lineNR :line |
- |l|
-
- line notNil ifTrue:[
- l := line withoutTrailingSeparators.
- list at:lineNR put:l.
- ]
+ |l|
+
+ line notNil ifTrue:[
+ l := line withoutTrailingSeparators.
+ list at:lineNR put:l.
+ ]
].
!
@@ -2961,7 +2946,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.
@@ -2999,11 +2984,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.
@@ -3030,7 +3015,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.
@@ -3040,18 +3025,18 @@
"stop auto scroll; deinstall timed-block"
autoScrollBlock notNil ifTrue:[
- Processor removeTimedBlock:autoScrollBlock.
- self compressMotionEvents:true.
- autoScrollBlock := nil.
- autoScrollDeltaT := nil
+ Processor removeTimedBlock:autoScrollBlock.
+ self compressMotionEvents:true.
+ autoScrollBlock := nil.
+ autoScrollDeltaT := nil
]
!
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
!
@@ -3060,14 +3045,14 @@
"return the width in pixels for a scroll between firstLine and lastLine"
selectionStartLine notNil ifTrue:[
- "/ if there is a selection which covers multiple lines,
- "/ we have to scroll the whole width (to include the selection-rectangle)
-
- (lastLine < selectionStartLine) ifFalse:[
- (firstLine > selectionEndLine) ifFalse:[
- ^ width
- ]
- ].
+ "/ if there is a selection which covers multiple lines,
+ "/ we have to scroll the whole width (to include the selection-rectangle)
+
+ (lastLine < selectionStartLine) ifFalse:[
+ (firstLine > selectionEndLine) ifFalse:[
+ ^ width
+ ]
+ ].
].
^ super widthForScrollBetween:firstLine and:lastLine
! !
@@ -3095,13 +3080,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"
@@ -3109,39 +3094,39 @@
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
startVisLineNr to:endVisLineNr do:[:visLine |
- self drawVisibleLineSelected:visLine
+ self drawVisibleLineSelected:visLine
]
!
drawVisibleLineSelected:visLineNr
self
- drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
- inVisible:visLineNr
- with:self currentSelectionFgColor and:self currentSelectionBgColor
+ drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
+ inVisible:visLineNr
+ with:self currentSelectionFgColor and:self currentSelectionBgColor
!
drawVisibleLineSelected:visLineNr col:col
self
- drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
- inVisible:visLineNr
- col:col
- with:self currentSelectionFgColor and:self currentSelectionBgColor
+ drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
+ inVisible:visLineNr
+ col:col
+ with:self currentSelectionFgColor and:self currentSelectionBgColor
!
drawVisibleLineSelected:visLineNr from:selectionStartCol
self
- drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
- inVisible:visLineNr
- from:selectionStartCol
- with:self currentSelectionFgColor and:self currentSelectionBgColor.
+ drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
+ inVisible:visLineNr
+ from:selectionStartCol
+ with:self currentSelectionFgColor and:self currentSelectionBgColor.
!
drawVisibleLineSelected:visLineNr from:startCol to:endCol
self
- drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
- inVisible:visLineNr
- from:startCol to:endCol
- with:self currentSelectionFgColor and:self currentSelectionBgColor.
+ drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
+ inVisible:visLineNr
+ from:startCol to:endCol
+ with:self currentSelectionFgColor and:self currentSelectionBgColor.
!
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
@@ -3153,70 +3138,70 @@
end := endVisLineNr.
(end > nLinesShown) ifTrue:[
- end := nLinesShown
+ end := nLinesShown
].
selectionEndLine isNil ifTrue:[
- selectionStartLine := nil
+ selectionStartLine := nil
].
selectionStartLine isNil ifTrue:[
- specialCare := false
+ specialCare := false
] ifFalse:[
- startLine := self visibleLineToAbsoluteLine:startVisLineNr.
- (startLine > selectionEndLine) ifTrue:[
- specialCare := false
- ] ifFalse:[
- endLine := self visibleLineToAbsoluteLine:end.
- (endLine < selectionStartLine) ifTrue:[
- specialCare := false
- ] ifFalse:[
- specialCare := true
- ]
- ]
+ startLine := self visibleLineToAbsoluteLine:startVisLineNr.
+ (startLine > selectionEndLine) ifTrue:[
+ specialCare := false
+ ] ifFalse:[
+ endLine := self visibleLineToAbsoluteLine:end.
+ (endLine < selectionStartLine) ifTrue:[
+ specialCare := false
+ ] ifFalse:[
+ specialCare := true
+ ]
+ ]
].
"easy: nothing is selected"
specialCare ifFalse:[
- super redrawFromVisibleLine:startVisLineNr to:end.
- ^ self
+ super redrawFromVisibleLine:startVisLineNr to:end.
+ ^ self
].
"easy: all is selected"
((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
- self drawSelectedFromVisibleLine:startVisLineNr to:end.
- ^ self
+ self drawSelectedFromVisibleLine:startVisLineNr to:end.
+ ^ self
].
(selectionStartLine >= firstLineShown) ifTrue:[
- "draw unselected top part"
-
- selVisStart := self listLineToVisibleLine:selectionStartLine.
- super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
-
- "and first partial selected line"
- self redrawVisibleLine:selVisStart.
-
- "rest starts after this one"
- line1 := selVisStart + 1
+ "draw unselected top part"
+
+ selVisStart := self listLineToVisibleLine:selectionStartLine.
+ super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
+
+ "and first partial selected line"
+ self redrawVisibleLine:selVisStart.
+
+ "rest starts after this one"
+ line1 := selVisStart + 1
] ifFalse:[
- line1 := 1
+ line1 := 1
].
(line1 > end) ifTrue:[^ self].
(line1 < startVisLineNr) ifTrue:[
- line1 := startVisLineNr
+ line1 := startVisLineNr
].
"draw middle part of selection"
(selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
- line2 := nLinesShown
+ line2 := nLinesShown
] ifFalse:[
- line2 := (self listLineToVisibleLine:selectionEndLine) - 1
+ line2 := (self listLineToVisibleLine:selectionEndLine) - 1
].
(line2 > end) ifTrue:[
- line2 := end
+ line2 := end
].
self drawSelectedFromVisibleLine:line1 to:line2.
@@ -3227,7 +3212,7 @@
self redrawVisibleLine:(line2 + 1).
((line2 + 2) <= end) ifTrue:[
- super redrawFromVisibleLine:(line2 + 2) to:end
+ super redrawFromVisibleLine:(line2 + 2) to:end
]
!
@@ -3238,50 +3223,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
@@ -3298,18 +3283,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
@@ -3323,22 +3308,22 @@
col := startCol.
col == 0 ifTrue:[
- col := 1.
+ col := 1.
].
(selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[
- line := self visibleLineToAbsoluteLine:visLine.
- (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 drawVisibleLineSelected:visLine from:col.
- ^ self
- ]
+ line := self visibleLineToAbsoluteLine:visLine.
+ (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 drawVisibleLineSelected:visLine from:col.
+ ^ self
+ ]
].
super redrawVisibleLine:visLine from:col
@@ -3356,75 +3341,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:
@@ -3434,14 +3419,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)
@@ -3449,7 +3434,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"
@@ -3462,8 +3447,8 @@
!
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."
@@ -3479,9 +3464,9 @@
col := startCol.
line := startLine.
forward ifTrue:[
- delta := 1.
+ delta := 1.
] ifFalse:[
- delta := -1.
+ delta := -1.
].
lineString := list at:line.
@@ -3489,30 +3474,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"
@@ -3534,8 +3519,8 @@
|ign match|
searchBarActionBlock notNil ifTrue:[
- searchBarActionBlock value:#forward value:self.
- ^ self
+ searchBarActionBlock value:#forward value:self.
+ ^ self
].
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
@@ -3543,17 +3528,17 @@
self setSearchPatternWithMatchEscapes: match.
lastSearchPattern notNil ifTrue:[
- lastSearchDirection == #backward ifTrue:[
- self
- searchBwd:lastSearchPattern
- ignoreCase:ign
- match: match
- ] ifFalse:[
- self
- searchFwd:lastSearchPattern
- ignoreCase:ign
- match: match
- ]
+ lastSearchDirection == #backward ifTrue:[
+ self
+ searchBwd:lastSearchPattern
+ ignoreCase:ign
+ match: match
+ ] ifFalse:[
+ self
+ searchFwd:lastSearchPattern
+ ignoreCase:ign
+ match: match
+ ]
]
"Created: / 03-05-1999 / 15:02:16 / cg"
@@ -3567,43 +3552,43 @@
|ign selectedVariable|
searchAction notNil ifTrue:[
- "/autosearch is cleared whenever there is search with user selection
- (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
+ "/autosearch is cleared whenever there is search with user selection
+ (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
].
searchAction notNil ifTrue:[
- "/confusing: this is for autosearch of variables (browse variable uses, for example)
- self searchUsingSearchAction:#backward.
- ^ self.
+ "/confusing: this is for autosearch of variables (browse variable uses, for example)
+ self searchUsingSearchAction:#backward.
+ ^ self.
].
searchBarActionBlock notNil ifTrue:[
- searchBarActionBlock value:#backward value:self.
- ^ self
+ searchBarActionBlock value:#backward value:self.
+ ^ self
].
lastSearchWasVariableSearch ifTrue:[
- selectedVariable := self syntaxElementForSelectedVariable.
- selectedVariable notNil ifTrue:[
- self searchVariableWithSyntaxElement:selectedVariable forward:false.
- ^ self.
- ].
- lastSearchWasVariableSearch := false.
+ selectedVariable := self syntaxElementForSelectedVariable.
+ selectedVariable notNil ifTrue:[
+ self searchVariableWithSyntaxElement:selectedVariable forward:false.
+ ^ self.
+ ].
+ lastSearchWasVariableSearch := false.
].
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
self setSearchPatternWithMatchEscapes: false.
lastSearchPattern isNil ifTrue:[
- LastSearchPatterns size > 0 ifTrue:[
- lastSearchPattern := LastSearchPatterns first
- ]
+ LastSearchPatterns size > 0 ifTrue:[
+ lastSearchPattern := LastSearchPatterns first
+ ]
].
lastSearchPattern notNil ifTrue:[
- lastSearchDirection := #backward.
- self rememberSearchPattern:lastSearchPattern.
- self
- searchBwd:lastSearchPattern
- ignoreCase:ign
+ lastSearchDirection := #backward.
+ self rememberSearchPattern:lastSearchPattern.
+ self
+ searchBwd:lastSearchPattern
+ ignoreCase:ign
]
"Modified: / 08-03-2012 / 14:26:25 / cg"
@@ -3623,9 +3608,9 @@
"do a backward search"
self
- searchBwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern)
- ifAbsent:aBlock
+ searchBwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern)
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:49 / cg"
!
@@ -3634,12 +3619,12 @@
"do a backward search"
self
- searchBwd:pattern
- ignoreCase:ign
- ifAbsent:[
- self sensor compressKeyPressEventsWithKey:#FindPrev.
- self showNotFound
- ].
+ searchBwd:pattern
+ ignoreCase:ign
+ ifAbsent:[
+ self sensor compressKeyPressEventsWithKey:#FindPrev.
+ self showNotFound
+ ].
"/ lastSearchIgnoredCase := ign.
lastSearchPattern := pattern string
@@ -3651,10 +3636,10 @@
"do a backward search"
self
- searchBwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign)
- ifAbsent:aBlock
+ searchBwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign)
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:49 / cg"
"Created: 13.9.1997 / 06:18:41 / cg"
@@ -3674,8 +3659,8 @@
"do a backward search"
self
- searchBwdUsingSpec:searchSpec
- ifAbsent:[self showNotFound].
+ searchBwdUsingSpec:searchSpec
+ ifAbsent:[self showNotFound].
"/ lastSearchIgnoredCase := false.
lastSearchPattern := searchSpec pattern string
@@ -3693,32 +3678,32 @@
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
"select characters enclosed by matching parenthesis if one is under startLine/Col"
self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:[:line :col |
- self selectFromLine:startLine col:startCol
- toLine:line col:col]
- ifNotFound:[self showNotFound]
- onError:[self beep]
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:[:line :col |
+ self selectFromLine:startLine col:startCol
+ toLine:line col:col]
+ ifNotFound:[self showNotFound]
+ onError:[self beep]
"Modified: 9.10.1997 / 12:57:34 / cg"
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
"search for a matching parenthesis; start search with character at startLine/startCol.
Search for the corresponding character is done forward if its an opening,
@@ -3727,20 +3712,20 @@
If there is a nesting error, evaluate failBlock."
^ self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' )
"Modified: / 12-04-2007 / 11:24:24 / 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; start search with character at startLine/startCol.
Search for the corresponding character is done forward if its an opening,
@@ -3749,14 +3734,14 @@
If there is a nesting error, evaluate failBlock."
^ self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<")
- closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
- ignoredCharacters: ignoreSet
- specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<")
+ closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
+ ignoredCharacters: ignoreSet
+ specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
"/ |i direction lineString
"/ parChar charSet closingChar
@@ -3906,11 +3891,11 @@
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- openingCharacters:openingCharacters
- closingCharacters:closingCharacters
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ openingCharacters:openingCharacters
+ closingCharacters:closingCharacters
"search for a matching parenthesis; start search with character at startLine/startCol.
Search for the corresponding character is done forward if its an opening,
@@ -3919,14 +3904,14 @@
If there is a nesting error, evaluate failBlock."
^ self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- openingCharacters: openingCharacters
- closingCharacters: closingCharacters
- ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
- specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ openingCharacters: openingCharacters
+ closingCharacters: closingCharacters
+ ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#())
+ specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/
"/ |i direction lineString
"/ parChar charSet closingChar
@@ -4076,13 +4061,13 @@
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- openingCharacters:openingCharacters
- closingCharacters:closingCharacters
- ignoredCharacters:ignoreSet
- specialEOLComment:eolCommentSequence
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ openingCharacters:openingCharacters
+ closingCharacters:closingCharacters
+ ignoredCharacters:ignoreSet
+ specialEOLComment:eolCommentSequence
"search for a matching parenthesis; start search with character at startLine/startCol.
Search for the corresponding character is done forward if its an opening,
@@ -4111,7 +4096,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 := (i <= openingCharacters size) ifTrue:[#fwd] ifFalse:[#bwd].
@@ -4123,13 +4108,13 @@
col := startCol.
line := startLine.
direction == #fwd ifTrue:[
- delta := 1.
- incSet := openingCharacters.
- decSet := closingCharacters.
+ delta := 1.
+ incSet := openingCharacters.
+ decSet := closingCharacters.
] ifFalse:[
- delta := -1.
- incSet := closingCharacters.
- decSet := openingCharacters.
+ delta := -1.
+ incSet := closingCharacters.
+ decSet := openingCharacters.
].
anySet := Set new.
anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
@@ -4142,101 +4127,101 @@
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.
-
- "/ check for comments.
-
- ((cc == eol1 and:[nextCC == eol2])
- 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.
+
+ "/ check for comments.
+
+ ((cc == eol1 and:[nextCC == eol2])
+ 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
@@ -4249,55 +4234,55 @@
|ign match variable|
searchAction notNil ifTrue:[
- "/ autosearch is cleared whenever there is search with user selection
- (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
+ "/ autosearch is cleared whenever there is search with user selection
+ (self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction].
].
searchAction notNil ifTrue:[
- "/ confusing: this is for autosearch of variables (browse variable uses, for example)
- self searchUsingSearchAction:#forward.
- ^ self.
+ "/ confusing: this is for autosearch of variables (browse variable uses, for example)
+ self searchUsingSearchAction:#forward.
+ ^ self.
].
searchBarActionBlock notNil ifTrue:[
- searchBarActionBlock value:#forward value:self.
- ^ self
+ searchBarActionBlock value:#forward value:self.
+ ^ self
].
lastSearchWasVariableSearch ifTrue:[
- variable := self syntaxElementForSelectedVariable.
- variable notNil ifTrue:[
- self searchVariableWithSyntaxElement:variable forward:true.
- ^ self.
- ].
- lastSearchWasVariableSearch := false.
+ variable := self syntaxElementForSelectedVariable.
+ variable notNil ifTrue:[
+ self searchVariableWithSyntaxElement:variable forward:true.
+ ^ self.
+ ].
+ lastSearchWasVariableSearch := false.
].
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
match := lastSearchWasMatch ? LastSearchWasMatch ? false.
selectStyle == #wordLeft ifTrue:[
- "
- remove the space from the selection
- "
- selectionStartCol := selectionStartCol + 1.
- super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
- selectStyle := #word.
- self selectionChanged.
+ "
+ remove the space from the selection
+ "
+ selectionStartCol := selectionStartCol + 1.
+ super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
+ selectStyle := #word.
+ self selectionChanged.
].
self setSearchPatternWithMatchEscapes: match.
lastSearchPattern isNil ifTrue:[
- LastSearchPatterns size > 0 ifTrue:[
- lastSearchPattern := LastSearchPatterns first
- ]
+ LastSearchPatterns size > 0 ifTrue:[
+ lastSearchPattern := LastSearchPatterns first
+ ]
].
lastSearchPattern notNil ifTrue:[
- self rememberSearchPattern:lastSearchPattern.
- lastSearchDirection := #forward.
- self
- searchFwd:lastSearchPattern
- ignoreCase:ign
- match: match
+ self rememberSearchPattern:lastSearchPattern.
+ lastSearchDirection := #forward.
+ self
+ searchFwd:lastSearchPattern
+ ignoreCase:ign
+ match: match
]
"Modified: / 08-03-2012 / 14:25:42 / cg"
@@ -4317,9 +4302,9 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern)
- ifAbsent:aBlock
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern)
+ ifAbsent:aBlock
"Modified: / 21-09-2006 / 16:51:28 / cg"
!
@@ -4328,13 +4313,13 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign)
- ifAbsent:[
- self sensor compressKeyPressEventsWithKey:#FindNext.
- self showNotFound
- ].
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign)
+ ifAbsent:[
+ self sensor compressKeyPressEventsWithKey:#FindNext.
+ self showNotFound
+ ].
"/ lastSearchIgnoredCase := ign.
lastSearchPattern := pattern string
@@ -4346,10 +4331,10 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign)
- ifAbsent:aBlock
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign)
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:35 / cg"
"Created: 13.9.1997 / 06:18:27 / cg"
@@ -4359,14 +4344,14 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign
- match:match)
- ifAbsent:[
- self sensor compressKeyPressEventsWithKey:#FindNext.
- self showNotFound
- ].
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign
+ match:match)
+ ifAbsent:[
+ self sensor compressKeyPressEventsWithKey:#FindNext.
+ self showNotFound
+ ].
"/ lastSearchIgnoredCase := ign.
"/ lastSearchWasMatch := match.
lastSearchPattern := pattern string
@@ -4379,11 +4364,11 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign
- match:match)
- ifAbsent:aBlock
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign
+ match:match)
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:35 / cg"
"Created: 13.9.1997 / 06:18:27 / cg"
@@ -4393,20 +4378,20 @@
"do a forward search"
self
- searchFwdUsingSpec:(ListView::SearchSpec new
- pattern:pattern
- ignoreCase:ign
- match:match)
- startingAtLine:startLine col:startCol
- ifAbsent:aBlock
+ searchFwdUsingSpec:(ListView::SearchSpec new
+ pattern:pattern
+ ignoreCase:ign
+ match:match)
+ startingAtLine:startLine col:startCol
+ ifAbsent:aBlock
!
searchFwdUsingSpec:searchSpec
"do a forward search"
self
- searchFwdUsingSpec:searchSpec
- ifAbsent:[self showNotFound].
+ searchFwdUsingSpec:searchSpec
+ ifAbsent:[self showNotFound].
"/ lastSearchIgnoredCase := false.
lastSearchPattern := searchSpec pattern string
@@ -4424,9 +4409,9 @@
startCol := pos x.
self
- searchFwdUsingSpec:searchSpec
- startingAtLine:startLine col:startCol
- ifAbsent:aBlock
+ searchFwdUsingSpec:searchSpec
+ startingAtLine:startLine col:startCol
+ ifAbsent:aBlock
"Modified: 13.9.1997 / 01:05:35 / cg"
"Created: 13.9.1997 / 06:18:27 / cg"
@@ -4436,12 +4421,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
@@ -4456,11 +4441,11 @@
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
@@ -4471,21 +4456,21 @@
|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.
+ ].
].
!
@@ -4499,10 +4484,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"
@@ -4532,9 +4517,9 @@
sel := self selection.
sel notNil ifTrue:[
- searchPattern := sel asString.
- match ifTrue:[searchPattern := searchPattern withMatchEscapes].
- self setSearchPattern:searchPattern.
+ searchPattern := sel asString.
+ match ifTrue:[searchPattern := searchPattern withMatchEscapes].
+ self setSearchPattern:searchPattern.
]
"Modified: / 6.3.1999 / 23:48:04 / cg"
@@ -4564,17 +4549,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.
@@ -4587,8 +4572,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"
@@ -4602,11 +4587,11 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
^ startCol @ startLine
@@ -4620,11 +4605,11 @@
|startLine startCol|
selectionStartLine notNil ifTrue:[
- startLine := selectionStartLine.
- startCol := selectionStartCol
+ startLine := selectionStartLine.
+ startCol := selectionStartCol
] ifFalse:[
- startLine := 1.
- startCol := 1
+ startLine := 1.
+ startCol := 1
].
^ startCol @ startLine
@@ -4641,31 +4626,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"
@@ -4677,34 +4662,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"
@@ -4715,29 +4700,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"
@@ -4749,33 +4734,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"
@@ -4820,15 +4805,15 @@
selectionEndLine isNil ifTrue:[^ false].
(line between:selectionStartLine and:selectionEndLine) ifFalse:[
- ^ false
+ ^ false
].
line == selectionStartLine ifTrue:[
- aColNr < selectionStartCol ifTrue:[^ false]
+ aColNr < selectionStartCol ifTrue:[^ false]
].
line == selectionEndLine ifTrue:[
- (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
+ (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
].
^ true
!
@@ -4839,15 +4824,15 @@
|line col|
selectionStartLine notNil ifTrue:[
- expandingTop == true ifTrue:[
- line := selectionStartLine.
- col := selectionStartCol.
- ] ifFalse:[
- line := selectionEndLine.
- col := selectionEndCol.
- ].
- self makeLineVisible:line.
- self makeColVisible:col inLine:line.
+ expandingTop == true 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"
@@ -4878,7 +4863,7 @@
|line1 col1 line2 col2|
pos1 > pos2 ifTrue:[
- ^ self unselect
+ ^ self unselect
].
line1 := self lineOfCharacterPosition:pos1.
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
@@ -4900,37 +4885,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.
]
"
@@ -4987,7 +4972,7 @@
selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
selectLine notNil ifTrue:[
- self selectLine:selectLine
+ self selectLine:selectLine
]
!
@@ -5004,12 +4989,12 @@
"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
- ]
+ wordAtLine:line col:col do:[
+ :beginLine :beginCol :endLine :endCol :style |
+
+ self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
+ selectStyle := style
+ ]
"Modified: 18.3.1996 / 17:30:38 / cg"
!
@@ -5023,8 +5008,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"
@@ -5046,11 +5031,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...
- (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
- sel := sel encodeFrom:gc 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
@@ -5096,9 +5081,9 @@
"can be redefined for notification or special actions"
device notNil ifTrue:[
- "On X11, be nice and set the PRIMARY selection.
- (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
- device setPrimaryText: self selectionAsString ownerView: self.
+ "On X11, be nice and set the PRIMARY selection.
+ (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
+ device setPrimaryText: self selectionAsString ownerView: self.
].
"Created: / 17-04-2012 / 20:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -5121,34 +5106,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
@@ -5190,18 +5175,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.
].
! !