summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-06-19 11:06:24 +0200
committerGitHub <noreply@github.com>2017-06-19 11:06:24 +0200
commit1fc170ee11c308fae14a06aa29f2d8e3882cf9ce (patch)
tree3729b0a24fd3b207c2f717da770407ba27f1d5bf /src/fe-text
parent4edfccfce794d4c10b2a92c02fe982bb089c6629 (diff)
parent9d3cfe1069b5cfaf0efb972e36695b781ecf93de (diff)
downloadirssi-1fc170ee11c308fae14a06aa29f2d8e3882cf9ce.zip
Merge branch 'master' into regexex
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/textbuffer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 9e791f4c..a920fab2 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -590,27 +590,30 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
pre_line = line;
for (i = 0; i < before; i++) {
if (pre_line->prev == NULL ||
- g_list_find(matches, pre_line->prev) != NULL)
+ g_list_nth_data(matches, 0) == pre_line->prev ||
+ g_list_nth_data(matches, 1) == pre_line->prev)
break;
pre_line = pre_line->prev;
}
for (; pre_line != line; pre_line = pre_line->next)
- matches = g_list_append(matches, pre_line);
+ matches = g_list_prepend(matches, pre_line);
match_after = after;
}
if (line_matched || match_after > 0) {
/* matched */
- matches = g_list_append(matches, line);
+ matches = g_list_prepend(matches, line);
if ((!line_matched && --match_after == 0) ||
(line_matched && match_after == 0 && before > 0))
- matches = g_list_append(matches, NULL);
+ matches = g_list_prepend(matches, NULL);
}
}
+ matches = g_list_reverse(matches);
+
if (preg != NULL)
i_regex_unref(preg);
g_string_free(str, TRUE);