Improve comments

This commit is contained in:
Zachary Yedidia
2021-08-21 17:58:30 -04:00
parent 0c2e139672
commit 0914f158c2
4 changed files with 43 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ var (
// Version is the version number or commit hash
Version = "0.0.0-unknown"
// Semantic version
// SemVersion is the Semantic version
SemVersion semver.Version
// CommitHash is the commit this version was built on
CommitHash = "Unknown"
@@ -421,14 +421,17 @@ func Clamp(val, min, max int) int {
return val
}
// IsNonAlphaNumeric returns if the rune is not a number of letter or underscore.
func IsNonAlphaNumeric(c rune) bool {
return !unicode.IsLetter(c) && !unicode.IsNumber(c) && c != '_'
}
// IsAutocomplete returns whether a character should begin an autocompletion.
func IsAutocomplete(c rune) bool {
return c == '.' || !IsNonAlphaNumeric(c)
}
// ParseSpecial replaces escaped ts with '\t'.
func ParseSpecial(s string) string {
return strings.ReplaceAll(s, "\\t", "\t")
}