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:
parent
d0cd181eb6
commit
3b49e1a2b6
5
eval.go
5
eval.go
@ -315,6 +315,11 @@ func (e *setExpr) eval(app *app, args []string) {
|
|||||||
case "timefmt":
|
case "timefmt":
|
||||||
gOpts.timefmt = e.val
|
gOpts.timefmt = e.val
|
||||||
case "truncatechar":
|
case "truncatechar":
|
||||||
|
if runeSliceWidth([]rune(e.val)) > 1 {
|
||||||
|
app.ui.echoerr("truncatechar: value should be 1 character long")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
gOpts.truncatechar = e.val
|
gOpts.truncatechar = e.val
|
||||||
default:
|
default:
|
||||||
app.ui.echoerrf("unknown option: %s", e.opt)
|
app.ui.echoerrf("unknown option: %s", e.opt)
|
||||||
|
Loading…
Reference in New Issue
Block a user