Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jhakonen/88a8e96ddaa4adf0fb558416dec919c4 to your computer and use it in GitHub Desktop.

Select an option

Save jhakonen/88a8e96ddaa4adf0fb558416dec919c4 to your computer and use it in GitHub Desktop.
Possible fixes for zim issue #84
diff --git a/zim/gui/widgets.py b/zim/gui/widgets.py
index 1c81e538..4d36cbd2 100644
--- a/zim/gui/widgets.py
+++ b/zim/gui/widgets.py
@@ -1664,6 +1664,8 @@ def gtk_entry_completion_match_func(completion, key, iter, column):
model = completion.get_model()
text = model.get_value(iter, column)
+ # Use non-normalized and non-casefolded key instead for comparison
+ key = completion.get_entry().get_text().lower()
if text is not None:
return key in text.lower()
else:
diff --git a/zim/gui/widgets.py b/zim/gui/widgets.py
index 1c81e538..3d645840 100644
--- a/zim/gui/widgets.py
+++ b/zim/gui/widgets.py
@@ -27,6 +27,7 @@ from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import GdkPixbuf
+from gi.repository import GLib
import logging
@@ -1664,8 +1665,10 @@ def gtk_entry_completion_match_func(completion, key, iter, column):
model = completion.get_model()
text = model.get_value(iter, column)
+ text = GLib.utf8_normalize(text, -1, GLib.NormalizeMode.ALL)
+ text = GLib.utf8_casefold(text, -1)
if text is not None:
- return key in text.lower()
+ return key in text
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment