summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-07-05 15:52:16 +0800
committerPeng Wu <alexepico@gmail.com>2016-07-05 16:11:27 +0800
commit4c2ba2e080b4ffd0dc611ba2b899ff7671332a7e (patch)
treebc1a22a906e261bc96bb6aefa29866a8183052a4
parent1673ea2fbc3bc020262d8bbd9e3f8d4cf1168e66 (diff)
downloadlibpinyin-4c2ba2e080b4ffd0dc611ba2b899ff7671332a7e.tar.gz
libpinyin-4c2ba2e080b4ffd0dc611ba2b899ff7671332a7e.tar.xz
libpinyin-4c2ba2e080b4ffd0dc611ba2b899ff7671332a7e.zip
add spaces
-rw-r--r--src/pinyin.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 0e49de7..ee117db 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2494,7 +2494,7 @@ static gchar * _get_aux_text_prefix(pinyin_instance_t * instance,
else
assert(FALSE);
- gchar * newprefix = g_strconcat(prefix, str, NULL);
+ gchar * newprefix = g_strconcat(prefix, str, " ", NULL);
g_free(str);
g_free(prefix);
@@ -2538,7 +2538,7 @@ static gchar * _get_aux_text_postfix(pinyin_instance_t * instance,
else
assert(FALSE);
- gchar * newpostfix = g_strconcat(postfix, str, NULL);
+ gchar * newpostfix = g_strconcat(postfix, str, " ", NULL);
g_free(str);
g_free(postfix);
@@ -2584,7 +2584,7 @@ bool pinyin_get_full_pinyin_auxiliary_text(pinyin_instance_t * instance,
gchar * pinyin = key.get_pinyin_string();
gchar * left = g_strndup(pinyin, len);
gchar * right = g_strdup(pinyin + len);
- middle = g_strconcat(left, "|", right, NULL);
+ middle = g_strconcat(left, "|", right, " ", NULL);
g_free(left);
g_free(right);
g_free(pinyin);
@@ -2651,14 +2651,20 @@ bool pinyin_get_double_pinyin_auxiliary_text(pinyin_instance_t * instance,
assert(FALSE);
}
+ g_free(shengmu);
+ g_free(yunmu);
+
+ gchar * newmiddle = NULL;
+
if (CHEWING_ZERO_TONE != key.m_tone) {
- gchar * newmiddle = g_strdup_printf("%s%d", middle, key.m_tone);
+ newmiddle = g_strdup_printf("%s%d", middle, key.m_tone);
g_free(middle);
middle = newmiddle;
}
- g_free(shengmu);
- g_free(yunmu);
+ newmiddle = g_strconcat(middle, " ", NULL);
+ g_free(middle);
+ middle = newmiddle;
offset = key_rest.m_raw_end;
}
@@ -2708,7 +2714,7 @@ bool pinyin_get_chewing_auxiliary_text(pinyin_instance_t * instance,
gchar * left = g_utf8_substring(zhuyin, 0, len);
gchar * right = g_utf8_substring(zhuyin, len, end);
- middle = g_strconcat(left, "|", right, NULL);
+ middle = g_strconcat(left, "|", right, " ", NULL);
g_free(left);
g_free(right);