reduce maxchars

This commit is contained in:
yory8 2019-04-04 10:50:15 +02:00
parent d29c605f99
commit 0f95eedd08

View file

@ -45,8 +45,10 @@ func dmenu(list []string, max int) (string, error) {
for _, original := range list {
repr := fmt.Sprintf("%#v", original)
max := len(repr) - 1 // drop right quote
if max > 800 { // dmenu will split lines longer than 1200 something; we cut at 800.
max = 800
maxChars := 400
// dmenu will split lines longer than 1200 something; we cut at 400 to spare memory
if max > maxChars {
max = maxChars
}
repr = repr[1:max] // drop left quote
guide[repr] = original