--- a/TextView.st Sat Jan 16 10:13:48 2016 +0000
+++ b/TextView.st Sat Jan 16 10:40:59 2016 +0000
@@ -29,7 +29,8 @@
DefaultAlternativeSelectionBackgroundColor MatchDelayTime
WordSelectCatchesBlanks LastSearchPatterns
NumRememberedSearchPatterns LastSearchIgnoredCase
- LastSearchWasMatch DefaultParenthesisSpecification'
+ LastSearchWasMatch DefaultParenthesisSpecification
+ LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText'
poolDictionaries:''
category:'Views-Text'
!
@@ -381,7 +382,7 @@
name: 'String search'
min: (Point 10 10)
max: (Point 1280 1024)
- bounds: (Rectangle 0 0 319 266)
+ bounds: (Rectangle 0 0 420 323)
)
component:
(SpecCollection
@@ -425,17 +426,36 @@
tabable: true
model: caseSensitive
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 420 24)
)
- (CheckBoxSpec
- label: 'Match (forward only)'
- name: 'matchCheckBox'
- activeHelpKey: matchSearch
- level: 0
- tabable: true
- model: match
- translateLabel: true
- extent: (Point 319 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 -151 1 0 0 0 1 22 0)
+ visibilityChannel: matchWithRegexVisible
+ enableChannel: match
+ model: matchWithRegex
+ translateLabel: true
+ )
+ )
+
+ )
+ extent: (Point 420 24)
)
(CheckBoxSpec
label: 'Search Full Words'
@@ -446,7 +466,7 @@
tabable: true
model: searchFullWord
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 420 24)
)
(CheckBoxSpec
label: 'At Begin of Line Only'
@@ -456,7 +476,7 @@
tabable: true
model: searchAtBeginOfLineOnly
translateLabel: true
- extent: (Point 319 24)
+ extent: (Point 420 24)
)
(CheckBoxSpec
label: 'Variable Only'
@@ -469,7 +489,7 @@
model: searchVariable
translateLabel: true
labelChannel: stringWithVariableUnderCursorHolder
- extent: (Point 319 24)
+ extent: (Point 420 24)
)
(CheckBoxSpec
label: 'Select Lines'
@@ -482,15 +502,25 @@
translateLabel: true
extent: (Point 302 24)
)
+ (CheckBoxSpec
+ label: 'Wrap at End of Text (forward only)'
+ name: 'CheckBox7'
+ activeHelpKey: searchAtBeginOfLineOnly
+ level: 0
+ tabable: true
+ model: wrapAtEndOfTextHolder
+ translateLabel: true
+ extent: (Point 420 24)
+ )
(ViewSpec
- name: 'Box1'
+ name: 'ReplaceBox'
component:
(SpecCollection
collection: (
(CheckBoxSpec
label: 'Global Replace With:'
name: 'CheckBox4'
- layout: (LayoutFrame 0 0 0 0 162 0 23 0)
+ layout: (LayoutFrame 0 0 0 0 180 0 23 0)
activeHelpKey: replaceText
level: 0
enableChannel: replaceEnabled
@@ -500,7 +530,7 @@
)
(InputFieldSpec
name: 'ReplaceEntryField'
- layout: (LayoutFrame 164 0 0 0 -2 1 22 0)
+ layout: (LayoutFrame 180 0 0 0 -2 1 22 0)
activeHelpKey: replaceText
visibilityChannel: replaceBoolean
enableChannel: replaceBoolean
@@ -512,7 +542,7 @@
)
)
- extent: (Point 319 24)
+ extent: (Point 420 24)
)
)
@@ -1981,13 +2011,27 @@
changeFont
"pop up a fontPanel to change font"
- |newFont|
+ |newFont fp|
self withWaitCursorDo:[
- newFont := FontPanel fontFromUserInitial:gc font.
+ fp := FontPanel new.
+ fp withChangeFontInViewsAllCheckBox:true.
+ newFont := fp fontFromUserInitial:self font.
].
newFont notNil ifTrue:[
self font:newFont.
+ fp changeFontInAllViews ifTrue:[
+ "/ user checked this box - change the defaults,
+ "/ and update all other textviews now.
+
+ TextView defaultFont:newFont.
+ UserPreferences current fontPreferences
+ at:#Text put:(newFont storeString).
+ DebugView newDebugger.
+ TextView allSubInstances do:[:v |
+ v font:newFont
+ ].
+ ].
]
"Modified: 27.2.1996 / 00:53:51 / cg"
@@ -2163,7 +2207,8 @@
Q: is it a good idea to preserve the last searchstring between views?
cg: yes - turns out to be useful and less confusing than keeping last per view
"
- |searchBox patternHolder caseHolder matchHolder fwd ign match initialString
+ |searchBox patternHolder caseHolder matchHolder matchWithRegexHolder wrapAtEndHolder
+ fwd ign match initialString
bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder
replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder
searchAtBeginOfLineOnlyHolder|
@@ -2181,6 +2226,8 @@
match := lastSearchWasMatch ? LastSearchWasMatch ? false.
matchHolder := match asValue.
+ matchWithRegexHolder := (LastSearchWasMatchWithRegex ? false) asValue.
+ wrapAtEndHolder := (LastSearchWasWrapAtEndOfText ? false) asValue.
searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue.
searchFullWordHolder := false asValue.
searchAtBeginOfLineOnlyHolder := false asValue.
@@ -2226,6 +2273,8 @@
lastSearchWasVariableSearch := false.
LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not).
LastSearchWasMatch := lastSearchWasMatch := matchHolder value.
+ LastSearchWasMatchWithRegex := matchWithRegexHolder value.
+ LastSearchWasWrapAtEndOfText := wrapAtEndHolder value.
pattern := patternHolder value.
pattern notEmptyOrNil ifTrue:[
searchAction := [
@@ -2233,11 +2282,13 @@
ListView::SearchSpec new
pattern:pattern
ignoreCase:lastSearchIgnoredCase
- match: lastSearchWasMatch
+ match: lastSearchWasMatch
+ regexMatch:matchWithRegexHolder value
variable: searchVariableHolder value
fullWord: searchFullWordHolder value
forward:fwd
- atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value).
+ atBeginOfLineOnly:searchAtBeginOfLineOnlyHolder value
+ wrapAtEnd:wrapAtEndHolder value).
]
]
].
@@ -2285,6 +2336,12 @@
].
bindings at:#caseSensitive put:caseHolder.
bindings at:#match put:matchHolder.
+ bindings at:#matchWithRegex put:matchWithRegexHolder.
+ Regex::RxMatcher isNil ifTrue:[
+ bindings at:#matchWithRegexVisible put:false.
+ ] ifFalse:[
+ bindings at:#matchWithRegexVisible put:matchHolder
+ ].
bindings at:#patternList put:LastSearchPatterns.
self supportsSyntaxElements ifFalse:[
@@ -2297,7 +2354,7 @@
bindings
at:#stringWithVariableUnderCursorHolder
put:(resources string:'Variable ("%1")' with:selectedVariable name).
- searchVariableHolder value:true.
+ "/ searchVariableHolder value:true.
] ifFalse:[
bindings
at:#stringWithVariableUnderCursorHolder
@@ -2309,7 +2366,8 @@
bindings at:#searchFullWord put:searchFullWordHolder.
bindings at:#searchFullWordEnabled put:true.
bindings at:#searchAtBeginOfLineOnly put:searchAtBeginOfLineOnlyHolder.
-
+ bindings at:#wrapAtEndOfTextHolder put:wrapAtEndHolder.
+
bindings at:#replaceEnabled put:replaceBooleanEnabledHolder.
bindings at:#replaceBoolean put:replaceBooleanHolder.
bindings at:#replaceTextHolder put:replaceTextHolder.
@@ -2553,7 +2611,8 @@
nativeWindowType
"return a symbol describing my native window type
- (may be used internally by the device as a native window creation hint)"
+ (may be used internally by the device as a native window creation hint,
+ if the device supports native windows)"
^ #TextView
@@ -4246,10 +4305,12 @@
"do a forward search"
self
- searchForwardUsingSpec:searchSpec
- startingAtLine:startLine col:startCol
- ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
- ifAbsent:aBlock
+ searchForwardUsingSpec:searchSpec
+ startingAtLine:startLine col:startCol
+ ifFound:[:line :col |
+ self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col
+ ]
+ ifAbsent:aBlock
!
searchPattern