p-gen/smenu

A word's length has reached the limit (256), exiting.

mare-imbrium opened this issue · 5 comments

I am getting a crash on this, even though I am piping in 80 chars.
I have a file and the usage is:
selection=$(cut -c1-80 $TMPFILE | smenu -W$'\n' -n 22)

If I replace smenu with fzf it runs fine. I am not sure why smenu is giving this error.

Attaching the file for your information. Thanks a lot for the great work.

If I take the file, I attached and do this on the command line, it works:
head -n 14 | smenu

But if I do one more line, no matter what the line is, it crashes.

 head -n 15 | smenu

(I am on OSX High Sierra)

p-gen commented

Hi, I cannot find your attached files, could you send them directly to p.gen.progs@gmail.com please?

p-gen commented

The word length limit can be easily triggered by a forgotten single or double quote in the input. Did you check that?
BTW this limits now defaults to 512, are you using the latest version (0.9.14)?

p-gen commented

Thank you for sending me your file (t.txt). My previous comment is relevant here because your file contains single quotes that you must escape. Try:

selection=$(sed -e "s/'/\\\'/g" -e 's/"/\\"/g' $TMPFILE | cut -c1-80 | smenu -W$'\n' -n 22)

and it should work. BTW you should also add -c to the smenu option to ensure that the result will only be displayed on one column.

Thanks a lot. Will take care in future.
Cheers.