From 4443aa27c89a43f7224fa1df8fbc982572a133cb Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 22 Mar 2013 08:42:41 +0100 Subject: [PATCH] improve country selection auto-completion --- proxinstall | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/proxinstall b/proxinstall index 0b384d0..d7082dd 100755 --- a/proxinstall +++ b/proxinstall @@ -1521,6 +1521,7 @@ sub create_country_view { $c->set_text_column (0); $c->set_minimum_key_length(0); $c->set_popup_set_width (1); + $c->set_inline_completion (1); my $hbox2 = Gtk3::HBox->new (0, 0); my $label = Gtk3::Label->new ("Time zone"); @@ -1573,18 +1574,24 @@ sub create_country_view { if ($val == Gtk3::Gdk::KEY_Tab) { my $cc = $countryhash->{lc($text)}; - return undef if $cc; + my $found = 0; my $compl; - foreach my $cc (keys %$ctr) { - my $ct = $ctr->{$cc}->{name}; - if ($ct =~ m/^\Q$text\E.*$/i) { - $found++; - $compl = $ct; + if ($cc) { + $found = 1; + $compl = $ctr->{$cc}->{name}; + } else { + foreach my $cc (keys %$ctr) { + my $ct = $ctr->{$cc}->{name}; + if ($ct =~ m/^\Q$text\E.*$/i) { + $found++; + $compl = $ct; + } + last if $found > 1; } - last if $found > 1; } + if ($found == 1) { $entry->set_text($compl); $c->complete(); -- 2.39.5