anjuta r4906 - in trunk: . plugins/search
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4906 - in trunk: . plugins/search
- Date: Sat, 28 Mar 2009 21:38:38 +0000 (UTC)
Author: sgranjoux
Date: Sat Mar 28 21:38:38 2009
New Revision: 4906
URL: http://svn.gnome.org/viewvc/anjuta?rev=4906&view=rev
Log:
* plugins/search/search-replace.c,
plugins/search/search-replace_backend.c:
Fix wrong line number (+1) when searching in editors
Modified:
trunk/ChangeLog
trunk/plugins/search/search-replace.c
trunk/plugins/search/search-replace_backend.c
Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c (original)
+++ trunk/plugins/search/search-replace.c Sat Mar 28 21:38:38 2009
@@ -654,9 +654,7 @@
int line = mi->line;
gchar *buf;
gchar *path = NULL;
-
- if (se->type == SE_FILE)
- ++line;
+
if (fb->file != NULL)
{
gchar *dir_uri = NULL;
Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c (original)
+++ trunk/plugins/search/search-replace_backend.c Sat Mar 28 21:38:38 2009
@@ -222,32 +222,26 @@
static long
file_buffer_line_from_pos(FileBuffer *fb, gint pos)
{
- gint lineno = -1;
-
g_return_val_if_fail(fb && pos >= 0, 1);
if (FB_FILE == fb->type)
{
GList *tmp;
+ gint lineno = 0;
if (fb->lines == NULL)
{
gint i;
/* First line starts at column 0 */
fb->lines = g_list_prepend(fb->lines, GINT_TO_POINTER(0));
- lineno = 0;
for (i=0; i < fb->len; ++i)
{
if ('\n' == fb->buf[i] && '\0' != fb->buf[i+1])
{
fb->lines = g_list_prepend(fb->lines, GINT_TO_POINTER(i + 1));
- if (0 == fb->line && fb->pos > i)
- fb->line = lineno;
- ++ lineno;
}
}
fb->lines = g_list_reverse(fb->lines);
- lineno = -1;
}
for (tmp = fb->lines; tmp; tmp = g_list_next(tmp))
@@ -262,6 +256,7 @@
{
IAnjutaIterable *position;
gint offset;
+ gint lineno;
offset = g_utf8_strlen (fb->buf, pos);
position = ianjuta_editor_get_position_from_offset (fb->te, offset, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]