Fixed Bug 1554714 - improve order of unicode matches
This commit is contained in:
parent
76af58317c
commit
e4d7f1ede0
@ -72,3 +72,85 @@ index 8707e432..24029703 100644
|
||||
--
|
||||
2.14.3
|
||||
|
||||
From b184861396279d903e62bf6aad271a2205a79832 Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Fri, 30 Mar 2018 12:33:59 +0900
|
||||
Subject: [PATCH] ui/gtk3: Sort Unicode candidates
|
||||
|
||||
BUG=rhbz#1554714
|
||||
R=Shawn.P.Huang@gmail.com
|
||||
|
||||
Review URL: https://codereview.appspot.com/339430043
|
||||
---
|
||||
ui/gtk3/emojier.vala | 26 +++++++++++++++++++++++---
|
||||
1 file changed, 23 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
|
||||
index 24029703..0c0865f1 100644
|
||||
--- a/ui/gtk3/emojier.vala
|
||||
+++ b/ui/gtk3/emojier.vala
|
||||
@@ -1144,9 +1144,11 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||
lookup_emojis_from_annotation(string annotation) {
|
||||
GLib.SList<string>? total_emojis = null;
|
||||
unowned GLib.SList<string>? sub_emojis = null;
|
||||
+ unowned GLib.SList<unichar>? sub_exact_unicodes = null;
|
||||
unowned GLib.SList<unichar>? sub_unicodes = null;
|
||||
int length = annotation.length;
|
||||
if (m_has_partial_match && length >= m_partial_match_length) {
|
||||
+ GLib.SList<string>? sorted_emojis = null;
|
||||
foreach (unowned string key in
|
||||
m_annotation_to_emojis_dict.get_keys()) {
|
||||
if (key.length < length)
|
||||
@@ -1173,16 +1175,29 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||
sub_emojis = m_annotation_to_emojis_dict.lookup(key);
|
||||
foreach (unowned string emoji in sub_emojis) {
|
||||
if (total_emojis.find_custom(emoji, GLib.strcmp) == null) {
|
||||
- total_emojis.append(emoji);
|
||||
+ sorted_emojis.insert_sorted(emoji, GLib.strcmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
+ foreach (string emoji in sorted_emojis) {
|
||||
+ if (total_emojis.find_custom(emoji, GLib.strcmp) == null) {
|
||||
+ total_emojis.append(emoji);
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
sub_emojis = m_annotation_to_emojis_dict.lookup(annotation);
|
||||
foreach (unowned string emoji in sub_emojis)
|
||||
total_emojis.append(emoji);
|
||||
}
|
||||
+ sub_exact_unicodes = m_name_to_unicodes_dict.lookup(annotation);
|
||||
+ foreach (unichar code in sub_exact_unicodes) {
|
||||
+ string ch = code.to_string();
|
||||
+ if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
|
||||
+ total_emojis.append(ch);
|
||||
+ }
|
||||
+ }
|
||||
if (length >= m_partial_match_length) {
|
||||
+ GLib.SList<string>? sorted_unicodes = null;
|
||||
foreach (unowned string key in m_name_to_unicodes_dict.get_keys()) {
|
||||
bool matched = false;
|
||||
if (key.index_of(annotation) >= 0)
|
||||
@@ -1192,11 +1207,16 @@ public class IBusEmojier : Gtk.ApplicationWindow {
|
||||
sub_unicodes = m_name_to_unicodes_dict.lookup(key);
|
||||
foreach (unichar code in sub_unicodes) {
|
||||
string ch = code.to_string();
|
||||
- if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
|
||||
- total_emojis.append(ch);
|
||||
+ if (sorted_unicodes.find_custom(ch, GLib.strcmp) == null) {
|
||||
+ sorted_unicodes.insert_sorted(ch, GLib.strcmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
+ foreach (string ch in sorted_unicodes) {
|
||||
+ if (total_emojis.find_custom(ch, GLib.strcmp) == null) {
|
||||
+ total_emojis.append(ch);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
return total_emojis;
|
||||
}
|
||||
--
|
||||
2.14.3
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
Name: ibus
|
||||
Version: 1.5.18
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Intelligent Input Bus for Linux OS
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -431,6 +431,9 @@ dconf update || :
|
||||
%{_datadir}/gtk-doc/html/*
|
||||
|
||||
%changelog
|
||||
* Fri Mar 30 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.18-4
|
||||
- Fixed Bug 1554714 - improve order of unicode matches
|
||||
|
||||
* Thu Mar 15 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.18-3
|
||||
- Fixed Bug 1554813 - Enter key on numpad in Emojier
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user