fix for rofi lines issue

This commit is contained in:
Paul Wilde 2023-02-17 11:57:34 +00:00
parent 535cc5e6b9
commit 6b56cb83a8

View file

@ -189,16 +189,18 @@ proc markup(str: string): string =
proc genMenuCmd*(data: Info, opts: varargs[string], rofi: bool = false): string =
# Build dmenu/rofi command
var cmd = ""
var x_lines = len(opts) + 1
# if the text is empty, we don't want to create a menu item of it
if data.full_text != "":
let text = markup(data.full_text)
cmd &= text & "\n"
else:
x_lines -= 1
for opt in opts:
let text = markup(opt)
cmd = cmd & text & "\n"
cmd.removeSuffix("\n")
var x_lines = len(opts) + 1
if x_lines > MAX_LINES:
x_lines = MAX_LINES