From 50292adacbad70f9561bc1e22ccbd3adea22481a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 31 Mar 2015 22:05:02 +0900 Subject: Implement --toggle-sort option (#173) --- src/pattern.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/pattern.go') diff --git a/src/pattern.go b/src/pattern.go index 7acdbcfa..fbb70c5f 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -54,17 +54,21 @@ var ( ) func init() { - // We can uniquely identify the pattern for a given string since - // mode and caseMode do not change while the program is running - _patternCache = make(map[string]*Pattern) _splitRegex = regexp.MustCompile("\\s+") - _cache = NewChunkCache() + clearPatternCache() + clearChunkCache() } func clearPatternCache() { + // We can uniquely identify the pattern for a given string since + // mode and caseMode do not change while the program is running _patternCache = make(map[string]*Pattern) } +func clearChunkCache() { + _cache = NewChunkCache() +} + // BuildPattern builds Pattern object from the given arguments func BuildPattern(mode Mode, caseMode Case, nth []Range, delimiter *regexp.Regexp, runes []rune) *Pattern { -- cgit v1.2.3