def __checkTextMatches(self, folders, items, buffer, windowInfo, immediate=False):
itemMatches = []<EOL>folderMatches = []<EOL>for item in items:<EOL><INDENT>if item.check_input(buffer, windowInfo):<EOL><INDENT>if not item.prompt and immediate:<EOL><INDENT>return item, None<EOL><DEDENT>else:<EOL><INDENT>itemMatches.append(item)<EOL><DEDENT><DEDENT><DEDENT>for folder in folders:<EOL><INDENT>if folder.check_input(buffer, windowInfo):<EOL><INDENT>folderMatches.append(folder)<EOL>break <EOL><DEDENT><DEDENT>if self.__menuRequired(folderMatches, itemMatches, buffer):<EOL><INDENT>self.lastStackState = buffer<EOL>return None, (folderMatches, itemMatches)<EOL><DEDENT>elif len(itemMatches) == <NUM_LIT:1>:<EOL><INDENT>self.lastStackState = buffer<EOL>return itemMatches[<NUM_LIT:0>], None<EOL><DEDENT>else:<EOL><INDENT>return None, None<EOL><DEDENT>
Check for an abbreviation/predictive match among the given folder and items
(scripts, phrases).

@return: a tuple possibly containing an item to execute, or a menu to show