summaryrefslogtreecommitdiff
path: root/src/util/util.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-19 01:59:14 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-19 01:59:14 +0900
commite70a2a5817586e4e7df0ee1446f609bbd859164a (patch)
tree24ea4cb8865233ec89e2e2828a66727cf0b129f4 /src/util/util.go
parentd80a41bb6d1a507d65885d553a30d4e7dc7d0453 (diff)
downloadfzf-e70a2a5817586e4e7df0ee1446f609bbd859164a.tar.gz
Add support for ANSI color codes
Diffstat (limited to 'src/util/util.go')
-rw-r--r--src/util/util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/util.go b/src/util/util.go
index 14833c04..1f53cc76 100644
--- a/src/util/util.go
+++ b/src/util/util.go
@@ -27,6 +27,17 @@ func Max32(first int32, second int32) int32 {
return second
}
+// Constrain32 limits the given 32-bit integer with the upper and lower bounds
+func Constrain32(val int32, min int32, max int32) int32 {
+ if val < min {
+ return min
+ }
+ if val > max {
+ return max
+ }
+ return val
+}
+
// Constrain limits the given integer with the upper and lower bounds
func Constrain(val int, min int, max int) int {
if val < min {