Add check for truncatechar (#420)

* Add check for truncatechar

When value is longer than 1 character, it throws an error

* Use runeSliceWidth instead of len
This commit is contained in:
Alexey Yerin 2020-07-19 21:28:06 +03:00 committed by GitHub
parent d0cd181eb6
commit 3b49e1a2b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -315,6 +315,11 @@ func (e *setExpr) eval(app *app, args []string) {
case "timefmt":
gOpts.timefmt = e.val
case "truncatechar":
if runeSliceWidth([]rune(e.val)) > 1 {
app.ui.echoerr("truncatechar: value should be 1 character long")
return
}
gOpts.truncatechar = e.val
default:
app.ui.echoerrf("unknown option: %s", e.opt)