From 0f95eedd0898188ed3463e20ef5214818b62f1b5 Mon Sep 17 00:00:00 2001 From: yory8 <> Date: Thu, 4 Apr 2019 10:50:15 +0200 Subject: [PATCH] reduce maxchars --- selector.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selector.go b/selector.go index 22ffcbb..eaa6d4f 100644 --- a/selector.go +++ b/selector.go @@ -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