[geany/geany-plugins] 55dd6b: pohelper: Fix reflow to use the number of characters, not bytes
Colomban Wendling
git-noreply at xxxxx
Wed Mar 13 00:45:34 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Wed, 13 Mar 2013 00:45:34 UTC
Commit: 55dd6b59828f82f9b3dd7512bcdcd212a2c1816b
https://github.com/geany/geany-plugins/commit/55dd6b59828f82f9b3dd7512bcdcd212a2c1816b
Log Message:
-----------
pohelper: Fix reflow to use the number of characters, not bytes
Modified Paths:
--------------
pohelper/src/gph-plugin.c
Modified: pohelper/src/gph-plugin.c
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -684,7 +684,6 @@ enum {
/* cuts @str in human-readable chunks for max @len.
* cuts first at \n, then at spaces and punctuation */
-/* FIXME: support utf-8 */
static gchar **
split_msg (const gchar *str,
gint len)
@@ -699,6 +698,7 @@ enum {
while (*str) {
const gchar *nl = strstr (str, "\\n");
const gchar *p = strpbrk (str, " \t\v\r\n?!,.;:");
+ glong chunk_len = g_utf8_strlen (chunk->str, (gssize) chunk->len);
if (nl)
nl += 2;
@@ -708,12 +708,12 @@ enum {
else /* if there is no separator, use the end of the string */
p = strchr (str, 0);
- if (nl && (chunk->len + nl - str <= len ||
+ if (nl && ((chunk_len + g_utf8_strlen (str, nl - str)) <= len ||
(nl < p && chunk->len == 0))) {
g_string_append_len (chunk, str, nl - str);
str = nl;
break;
- } else if (chunk->len + p - str <= len ||
+ } else if ((chunk_len + g_utf8_strlen (str, p - str)) <= len ||
chunk->len == 0) {
g_string_append_len (chunk, str, p - str);
str = p;
@@ -743,7 +743,7 @@ enum {
if (msgstr) {
gint start = find_msgstr_start_at (doc, pos);
gint end = find_msgstr_end_at (doc, pos);
- glong len = g_utf8_strlen (msgstr->str, msgstr->len);
+ glong len = g_utf8_strlen (msgstr->str, (gssize) msgstr->len);
/* FIXME: line_break_column isn't supposedly public */
gint line_len = geany_data->editor_prefs->line_break_column;
gint msgstr_kw_len;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list