Commit f956eed7 authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

make utf8-aware.

2006-01-05  Paolo Borelli  <pborelli@katamail.com>

	* gedit/gedit-document.c (compute_num_of_lines): make utf8-aware.
parent 8f7235a3
2006-01-05 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-document.c (compute_num_of_lines): make utf8-aware.
2005-01-05 Steve Frécinaux <nud@apinc.org>
* gedit/gedit-view.c : larger timeout for the search box, scroll back
......
......@@ -1301,33 +1301,29 @@ gedit_document_goto_line (GeditDocument *doc,
return ret;
}
/* FIXME: This needs to be fixed to be UTF-8 compliant. pbor had a patch. */
static gint
static gint
compute_num_of_lines (const gchar *text)
{
gint n;
gint length;
const gchar *p;
const gchar *end;
gint len;
gint n = 0;
g_return_val_if_fail (text != NULL, 0);
length = strlen (text);
len = strlen (text);
p = text;
while (len > 0)
{
gint i;
p = text;
end = text + length;
pango_find_paragraph_boundary (p, len, NULL, &i);
p += i;
len -= i;
++n;
}
n = 1;
while (p != end)
{
if (*p == '\n') /* FIXME: other characters? */
++n;
p = g_utf8_next_char (p);
}
return n;
return n;
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment