diff options
author | nyamatongwe <unknown> | 2004-10-03 12:52:16 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-10-03 12:52:16 +0000 |
commit | 2c5c331cc1a3f52ca7ad5b19b60891a0c751698c (patch) | |
tree | 63729e334770d51c08aea05524899a6197794dee | |
parent | d941fb8a26c981607fc401f06931e0861f14efa2 (diff) | |
download | scintilla-mirror-2c5c331cc1a3f52ca7ad5b19b60891a0c751698c.tar.gz |
Patch from Shane Caraveo for GTK+ 2 to make finishing
autocomplete with a prefix not matching any item in the list not
cause the prefix to be deleted.
-rw-r--r-- | gtk/PlatGTK.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index d6a282476..aff915372 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -2106,13 +2106,16 @@ void ListBoxX::Select(int n) { gtk_clist_moveto(GTK_CLIST(list), n, 0, 0.5, 0.5); } #else - if (n < 0) - return; - GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); + + if (n < 0) { + gtk_tree_selection_unselect_all(selection); + return; + } + bool valid = gtk_tree_model_iter_nth_child(model, &iter, NULL, n); if (valid) { gtk_tree_selection_select_iter(selection, &iter); @@ -2147,6 +2150,8 @@ void ListBoxX::Select(int n) { // Set it. gtk_adjustment_set_value(adj, value); + } else { + gtk_tree_selection_unselect_all(selection); } #endif } @@ -2166,7 +2171,7 @@ int ListBoxX::GetSelection() { if (indices) return indices[0]; } - return 0; + return -1; #endif } @@ -2196,7 +2201,7 @@ int ListBoxX::Find(const char *prefix) { i++; } #endif - return - 1; + return -1; } void ListBoxX::GetValue(int n, char *value, int len) { |