# HG changeset patch # User fm # Date 1207326520 -7200 # Node ID 950b9b6939ee1a9ca876b1afdfeaba45860bce56 # Parent c9d10df2b8bc02ad01a2fd4a233a846178bd7e80 StringSearchTool diff -r c9d10df2b8bc -r 950b9b6939ee TextView.st --- a/TextView.st Fri Apr 04 18:26:13 2008 +0200 +++ b/TextView.st Fri Apr 04 18:28:40 2008 +0200 @@ -20,7 +20,7 @@ externalEncoding contentsWasSaved searchAction lastSearchPattern lastSearchWasMatch lastSearchIgnoredCase lastSearchMatch lastSearchDirection parenthesisSpecification dropSource - dragIsActive saveAction st80SelectMode' + dragIsActive saveAction st80SelectMode searchActionBlock' classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor DefaultSelectionBackgroundColor DefaultAlternativeSelectionForegroundColor @@ -772,6 +772,14 @@ saveAction:something saveAction := something. +! + +searchActionBlock + ^ searchActionBlock +! + +searchActionBlock:something + searchActionBlock := something. ! ! !TextView methodsFor:'accessing-contents'! @@ -1972,6 +1980,13 @@ |searchBox patternHolder caseHolder matchHolder fwd ign match initialString bindings bldr search modal| + searchActionBlock notNil ifTrue:[ + "/ clear the autosearch (browse variable uses, for example) + searchAction := nil. + searchActionBlock value:#search value:self. + ^ self + ]. + modal := (UserPreferences current searchDialogIsModal). "/ thats experimental ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. @@ -2758,6 +2773,11 @@ |ign match| + searchActionBlock notNil ifTrue:[ + searchActionBlock value:#forward value:self. + ^ self + ]. + ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. match := lastSearchWasMatch ? LastSearchWasMatch ? false. @@ -2785,9 +2805,14 @@ |ign| searchAction notNil ifTrue:[ + "/confusing: this is for autosearch of variables (browse variable uses, for example) self searchUsingSearchAction:#backward. ^ self. ]. + searchActionBlock notNil ifTrue:[ + searchActionBlock value:#backward value:self. + ^ self + ]. ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. @@ -3260,9 +3285,15 @@ |ign match| searchAction notNil ifTrue:[ + "/confusing: this is for autosearch of variables (browse variable uses, for example) self searchUsingSearchAction:#forward. ^ self. ]. + searchActionBlock notNil ifTrue:[ + searchActionBlock value:#forward value:self. + ^ self + ]. + ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. match := lastSearchWasMatch ? LastSearchWasMatch ? false. @@ -3389,15 +3420,26 @@ startCol := pos x. self + searchFwd:pattern + ignoreCase:ign + match: match + startingAtLine:startLine col:startCol + ifAbsent:aBlock + + "Modified: 13.9.1997 / 01:05:35 / cg" + "Created: 13.9.1997 / 06:18:27 / cg" +! + +searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock + "do a forward search" + + self searchForwardFor:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifFound:[:line :col | self showMatch:pattern atLine:line col:col] ifAbsent:aBlock - - "Modified: 13.9.1997 / 01:05:35 / cg" - "Created: 13.9.1997 / 06:18:27 / cg" ! searchPattern @@ -4025,7 +4067,7 @@ !TextView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.283 2008-04-02 11:58:30 fm Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.284 2008-04-04 16:28:40 fm Exp $' ! ! TextView initialize!