summaryrefslogtreecommitdiffstats
path: root/pkg/utils
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-24 21:57:53 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-25 09:39:04 +1100
commitd105e2690a244543c911148bb07774a3853087eb (patch)
treed154cb37f086e8d41f2f78e8dea58d880bf9d66e /pkg/utils
parent32d3e497c3612bd046afe9679f9e0b463a19c072 (diff)
vastly improve the logic for undo and redo
Diffstat (limited to 'pkg/utils')
-rw-r--r--pkg/utils/utils.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index f42ee130c..4afee73b7 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -316,3 +316,9 @@ func TruncateWithEllipsis(str string, limit int) string {
remainingLength := limit - len(ellipsis)
return str[0:remainingLength] + "..."
}
+
+func FindStringSubmatch(str string, regexpStr string) (bool, []string) {
+ re := regexp.MustCompile(regexpStr)
+ match := re.FindStringSubmatch(str)
+ return len(match) > 0, match
+}