reduce maxchars
This commit is contained in:
parent
d29c605f99
commit
0f95eedd08
1 changed files with 4 additions and 2 deletions
|
@ -45,8 +45,10 @@ func dmenu(list []string, max int) (string, error) {
|
||||||
for _, original := range list {
|
for _, original := range list {
|
||||||
repr := fmt.Sprintf("%#v", original)
|
repr := fmt.Sprintf("%#v", original)
|
||||||
max := len(repr) - 1 // drop right quote
|
max := len(repr) - 1 // drop right quote
|
||||||
if max > 800 { // dmenu will split lines longer than 1200 something; we cut at 800.
|
maxChars := 400
|
||||||
max = 800
|
// 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
|
repr = repr[1:max] // drop left quote
|
||||||
guide[repr] = original
|
guide[repr] = original
|
||||||
|
|
Loading…
Reference in a new issue