--- a/Tools__StringSearchToolForTextView.st Fri Oct 09 09:46:56 2009 +0200
+++ b/Tools__StringSearchToolForTextView.st Fri Oct 09 13:53:46 2009 +0200
@@ -337,6 +337,21 @@
anEditFieldView crAction: self crAction.
! !
+!StringSearchToolForTextView methodsFor:'misc'!
+
+trimMatchPattern: aString
+
+ ^ aString trimForWhich: [:ch | ch = $*].
+
+ "
+ '***foo***' trimForWhich: [:ch | ch = $*].
+ 'foo***' trimForWhich: [:ch | ch = $*].
+ '***foo' trimForWhich: [:ch | ch = $*].
+ '***f***o***o***' trimForWhich: [:ch | ch = $*].
+ 'foo' trimForWhich: [:ch | ch = $*].
+ "
+! !
+
!StringSearchToolForTextView methodsFor:'public'!
crAction
@@ -353,6 +368,25 @@
returnFocusToTextView
textView takeFocus
+!
+
+searchPreviousTextReachBeginning
+ |message searchText match |
+
+ searchText := searchTextView contents.
+ match := self matchHolder value.
+
+ match ifTrue: [
+ searchText := self trimMatchPattern: searchText.
+ (searchText includes: $*) ifTrue: [
+ message := 'Match pattern not available for backward search'.
+ self searchTextNotFound: message.
+ Smalltalk beep.
+ ^ self
+ ].
+ ].
+
+ super searchPreviousTextReachBeginning
! !
!StringSearchToolForTextView methodsFor:'searching'!
@@ -404,13 +438,17 @@
searchPreviousText
- |searchText ignoreCase absentBlock|
+ |searchText ignoreCase match absentBlock|
self searchTextStarted.
searchText := searchTextView contents.
searchText isEmptyOrNil ifTrue:[^self].
ignoreCase := self ignoreCaseHolder value.
self textView isNil ifTrue:[^ self].
+ match := self matchHolder value.
+ match ifTrue: [
+ searchText := self trimMatchPattern: searchText.
+ ].
absentBlock := [self searchPreviousTextReachBeginning].
self textView searchBwd:searchText ignoreCase:ignoreCase ifAbsent:absentBlock.
!
@@ -437,5 +475,9 @@
!StringSearchToolForTextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.9 2008-09-22 23:29:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.10 2009-10-09 11:53:46 fm Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.10 2009-10-09 11:53:46 fm Exp $'
! !