v1cont / yad

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

Confirming multi-file selection with Enter instead of OK drops all but one file #124

Closed schirmeier closed 3 years ago

schirmeier commented 3 years ago

When I confirm a multi-file selection (yad --file-selection --multiple) by hitting the ENTER key instead of clicking on OK, yad only returns the most-recently selected file instead of all selected ones.

Steps to reproduce:

touch a b
yad --file-selection --multiple
# select both a and b (by using Ctrl+click)
# press ENTER

Expected result: /tmp/test/a|/tmp/test/b

Actual result (seen when clicking OK instead of pressing ENTER): /tmp/test/b

I'm using YAD on Ubuntu 20.04 (x86_64):

$ yad --version
0.40.0 (GTK+ 3.24.20)
$ dpkg -l yad|grep ^ii
ii  yad            0.40.0-1     amd64        tool for creating graphical dialogs from shell scripts

Edit: I understand Ubuntu 20.04 uses an ancient version of YAD. However, the current git HEAD (v8.0-1-g06d526a) exhibits the same behavior when run with yad --file --multiple. (--file-selection seems to have been renamed to --file, breaking backward compatibility.)

schirmeier commented 3 years ago

Looks to me like this isn't YAD's fault but GTK+'s. In case I press ENTER instead of clicking OK, gtk_file_chooser_get_filenames() (src/file.c:133) returns a single-element GSList* instead of multiple entries.

schirmeier commented 3 years ago

I filed a GTK+ bug report: https://gitlab.gnome.org/GNOME/gtk/-/issues/3700

v1cont commented 3 years ago

No, this is not a gtk bug. Yad dialogs is a normal windows, not a GtkDialog. For some kinds of dialogs Return key has a special meaning, that`s why you must use ctrl+enter as a keyboard shortcut for OK button

schirmeier commented 3 years ago

OK -- that's not really obvious (let's call it a "UI bug"?), but solves my issue. Thanks!