mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Improve performance for very long lines
This commit is contained in:
@@ -294,3 +294,17 @@ func JoinCommandArgs(args ...string) string {
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func Sub(str string, start, end int) string {
|
||||
len := Count(str)
|
||||
if len > start && len > end {
|
||||
return str[start:end]
|
||||
}
|
||||
if len > start && len < end {
|
||||
return str[start:]
|
||||
}
|
||||
if len < start {
|
||||
return str
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user