--- a/FSelList.st Fri Feb 09 23:13:39 1996 +0100
+++ b/FSelList.st Sat Feb 10 10:32:49 1996 +0100
@@ -529,12 +529,12 @@
updateList
"set the lists contents to the filenames in the directory"
- |oldCursor files newList index path obsolete|
+ |oldCursor files newList index path obsolete matching patternList|
directory isNil ifTrue:[
- super list:nil.
- files := newList := fileTypes := nil.
- ^ self
+ super list:nil.
+ files := newList := fileTypes := nil.
+ ^ self
].
oldCursor := cursor.
@@ -546,17 +546,17 @@
there, has moved or is NFS-mounted differently)
"
obsolete := directoryId ~~ directory id
- or:[directoryName ~= directory pathName
- or:[timeStamp notNil
- and:[directory timeOfLastChange > timeStamp]]].
+ or:[directoryName ~= directory pathName
+ or:[timeStamp notNil
+ and:[directory timeOfLastChange > timeStamp]]].
obsolete ifTrue:[
- timeStamp := directory timeOfLastChange.
- directoryId := directory id.
- directoryName := directory pathName.
- directoryContents := directory asStringCollection sort.
- directoryFileTypes := OrderedCollection new.
- directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)].
+ timeStamp := directory timeOfLastChange.
+ directoryId := directory id.
+ directoryName := directory pathName.
+ directoryContents := directory asStringCollection sort.
+ directoryFileTypes := OrderedCollection new.
+ directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)].
].
files := directoryContents.
@@ -566,42 +566,52 @@
path := directory pathName , Filename separator asString.
files do:[:name |
- |type|
+ |type|
- (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[
- type := directoryFileTypes at:index.
- type == #directory ifTrue:[
- ignoreDirectories ifFalse:[
- name = '..' ifTrue:[
- ignoreParentDirectory ifFalse:[
- newList add:name.
- fileTypes add:type
- ]
- ] ifFalse:[
- name = '.' ifTrue:[
- "ignore"
- ] ifFalse:[
- newList add:(name ", ' ...'").
- fileTypes add:type
- ]
- ]
- ]
- ] ifFalse:[
- (pattern isNil
- or:[pattern isEmpty
- or:[pattern = '*'
- or:[pattern match:name]]]) ifTrue:[
- newList add:name.
- fileTypes add:type
- ]
- ].
- ].
- index := index + 1
+ (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[
+ type := directoryFileTypes at:index.
+ type == #directory ifTrue:[
+ ignoreDirectories ifFalse:[
+ name = '..' ifTrue:[
+ ignoreParentDirectory ifFalse:[
+ newList add:name.
+ fileTypes add:type
+ ]
+ ] ifFalse:[
+ name = '.' ifTrue:[
+ "ignore"
+ ] ifFalse:[
+ newList add:(name ", ' ...'").
+ fileTypes add:type
+ ]
+ ]
+ ]
+ ] ifFalse:[
+ matching := true.
+
+ (pattern isNil
+ or:[pattern isEmpty]) ifFalse:[
+ pattern = '*' ifFalse:[
+ (pattern includes:$;) ifTrue:[
+ patternList := pattern asCollectionOfSubstringsSeparatedBy:$;.
+ matching := (patternList findFirst:[:subPattern | subPattern match:name]) ~~ 0.
+ ] ifFalse:[
+ matching := pattern match:name
+ ]
+ ]
+ ].
+
+ matching ifTrue:[
+ newList add:name.
+ fileTypes add:type
+ ]
+ ].
+ ].
+ index := index + 1
].
super list:newList.
self cursor:oldCursor.
-
!
visibleLineNeedsSpecialCare:visLineNr
@@ -641,5 +651,5 @@
!FileSelectionList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/FSelList.st,v 1.23 1996-02-09 12:48:15 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/FSelList.st,v 1.24 1996-02-10 09:32:49 ca Exp $'
! !
--- a/FileSelectionList.st Fri Feb 09 23:13:39 1996 +0100
+++ b/FileSelectionList.st Sat Feb 10 10:32:49 1996 +0100
@@ -529,12 +529,12 @@
updateList
"set the lists contents to the filenames in the directory"
- |oldCursor files newList index path obsolete|
+ |oldCursor files newList index path obsolete matching patternList|
directory isNil ifTrue:[
- super list:nil.
- files := newList := fileTypes := nil.
- ^ self
+ super list:nil.
+ files := newList := fileTypes := nil.
+ ^ self
].
oldCursor := cursor.
@@ -546,17 +546,17 @@
there, has moved or is NFS-mounted differently)
"
obsolete := directoryId ~~ directory id
- or:[directoryName ~= directory pathName
- or:[timeStamp notNil
- and:[directory timeOfLastChange > timeStamp]]].
+ or:[directoryName ~= directory pathName
+ or:[timeStamp notNil
+ and:[directory timeOfLastChange > timeStamp]]].
obsolete ifTrue:[
- timeStamp := directory timeOfLastChange.
- directoryId := directory id.
- directoryName := directory pathName.
- directoryContents := directory asStringCollection sort.
- directoryFileTypes := OrderedCollection new.
- directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)].
+ timeStamp := directory timeOfLastChange.
+ directoryId := directory id.
+ directoryName := directory pathName.
+ directoryContents := directory asStringCollection sort.
+ directoryFileTypes := OrderedCollection new.
+ directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)].
].
files := directoryContents.
@@ -566,42 +566,52 @@
path := directory pathName , Filename separator asString.
files do:[:name |
- |type|
+ |type|
- (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[
- type := directoryFileTypes at:index.
- type == #directory ifTrue:[
- ignoreDirectories ifFalse:[
- name = '..' ifTrue:[
- ignoreParentDirectory ifFalse:[
- newList add:name.
- fileTypes add:type
- ]
- ] ifFalse:[
- name = '.' ifTrue:[
- "ignore"
- ] ifFalse:[
- newList add:(name ", ' ...'").
- fileTypes add:type
- ]
- ]
- ]
- ] ifFalse:[
- (pattern isNil
- or:[pattern isEmpty
- or:[pattern = '*'
- or:[pattern match:name]]]) ifTrue:[
- newList add:name.
- fileTypes add:type
- ]
- ].
- ].
- index := index + 1
+ (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[
+ type := directoryFileTypes at:index.
+ type == #directory ifTrue:[
+ ignoreDirectories ifFalse:[
+ name = '..' ifTrue:[
+ ignoreParentDirectory ifFalse:[
+ newList add:name.
+ fileTypes add:type
+ ]
+ ] ifFalse:[
+ name = '.' ifTrue:[
+ "ignore"
+ ] ifFalse:[
+ newList add:(name ", ' ...'").
+ fileTypes add:type
+ ]
+ ]
+ ]
+ ] ifFalse:[
+ matching := true.
+
+ (pattern isNil
+ or:[pattern isEmpty]) ifFalse:[
+ pattern = '*' ifFalse:[
+ (pattern includes:$;) ifTrue:[
+ patternList := pattern asCollectionOfSubstringsSeparatedBy:$;.
+ matching := (patternList findFirst:[:subPattern | subPattern match:name]) ~~ 0.
+ ] ifFalse:[
+ matching := pattern match:name
+ ]
+ ]
+ ].
+
+ matching ifTrue:[
+ newList add:name.
+ fileTypes add:type
+ ]
+ ].
+ ].
+ index := index + 1
].
super list:newList.
self cursor:oldCursor.
-
!
visibleLineNeedsSpecialCare:visLineNr
@@ -641,5 +651,5 @@
!FileSelectionList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.23 1996-02-09 12:48:15 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.24 1996-02-10 09:32:49 ca Exp $'
! !