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