gedit r6605 - in trunk: . gedit
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6605 - in trunk: . gedit
- Date: Sat, 22 Nov 2008 14:04:07 +0000 (UTC)
Author: icq
Date: Sat Nov 22 14:04:06 2008
New Revision: 6605
URL: http://svn.gnome.org/viewvc/gedit?rev=6605&view=rev
Log:
2008-11-22 Ignacio Casal Quinteiro <nacho resa gmail com>
* gedit/gedit-view.c:
Allow the use of "+N" and "-N" in the Move to Line entry.
Fixes bug #560013.
Modified:
trunk/ChangeLog
trunk/gedit/gedit-view.c
Modified: trunk/gedit/gedit-view.c
==============================================================================
--- trunk/gedit/gedit-view.c (original)
+++ trunk/gedit/gedit-view.c Sat Nov 22 14:04:06 2008
@@ -1253,12 +1253,24 @@
gunichar c;
const gchar *p;
const gchar *end;
+ const gchar *next;
p = text;
end = text + length;
- while (p != end) {
- const gchar *next;
+ if (p == end)
+ return;
+
+ c = g_utf8_get_char (p);
+
+ if (c == '-' || c == '+')
+ {
+ next = g_utf8_next_char (p);
+ p = next;
+ }
+
+ while (p != end)
+ {
next = g_utf8_next_char (p);
c = g_utf8_get_char (p);
@@ -1651,8 +1663,29 @@
{
gboolean moved;
gint line;
-
- line = MAX (atoi (entry_text) - 1, 0);
+ gint offset_line = 0;
+
+ if (*entry_text == '-')
+ {
+ if (*(entry_text + 1) != '\0')
+ offset_line = MAX (atoi (entry_text + 1), 0);
+
+ line = gtk_text_iter_get_line (&view->priv->start_search_iter)
+ - offset_line;
+ }
+ else if (*entry_text == '+')
+ {
+ if (*(entry_text + 1) != '\0')
+ offset_line = MAX (atoi (entry_text + 1), 0);
+
+ line = gtk_text_iter_get_line (&view->priv->start_search_iter)
+ + offset_line;
+ }
+ else
+ {
+ line = MAX (atoi (entry_text) - 1, 0);
+ }
+
moved = gedit_document_goto_line (doc, line);
gedit_view_scroll_to_cursor (view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]