v1cont / yad

Yet Another Dialog
GNU General Public License v3.0
657 stars 58 forks source link

Bugs with exit codes and returned text from --list #166

Open Raven-Singularity opened 2 years ago

Raven-Singularity commented 2 years ago

I am new to yad and have been trying to get it to work for my new project, a simple video editor using only bash + yad + mpv.

I have created my basic video editor timeline GUI the way I want, but I can not get the button return codes or return text to behave consistently. If I change any of the exit codes everything breaks randomly.

Three of my five buttons do not return the row text, while two of them do. If I change the exit codes for these buttons, they randomly work or break.

I have been using this command to isolate the bugs:

clear; yad --height=170 --center --list --no-headers --response=50 --column="one" --column="two" --button="Eleven":11 --button="Twelve":12 --button="Thirteen":13 A B C D E F; echo "($?)"

In this example, clicking the buttons Eleven or Thirteen does not output any text at all. Expected to have it output whatever item I selected, such as "A|B|" or "C|D|" etc. However, clicking button Twelve does return the text "A|B|" or "C|D|" etc. It also works when I press Enter on the keyboard.

This is driving me mad trying to set up my GUI. I can not create a simple list with 5 buttons to click -- 3 of the buttons won't return the row text! I need the button exit codes to be set correctly, and the row text to be properly output!

Okay, after a bunch more testing, I see that odd numbered exit codes fail while even numbered exit codes work. I assume this might have something to do with me having two columns? Not sure, it seems like bugs to me.

If I renumber all my exit codes to even numbers, like 10 20 30 40 or 2 4 6 8, it all works as expected.

Why the inconsistency?

phenixia2003 commented 2 years ago

Hello,

When you specify an odd exit-code the result is not printed, as stated the manual page (in 'EXIT CODE' section) :

"Even exit code mean to print result, odd just return exit code."

-- SeB

v1cont commented 2 years ago

use --always-print-result