summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: babaa6f)
raw | patch | inline | side by side (parent: babaa6f)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 18 Jan 2009 01:58:47 +0000 (02:58 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 22 Jan 2009 10:11:19 +0000 (11:11 +0100) |
tig.c | patch | blob | history |
index 32d2fb7d8a143a06883cc29523575ac9f99a5f7a..24794c6c32bb06d58abcbc750c89e1878127ec71 100644 (file)
--- a/tig.c
+++ b/tig.c
static void search_view(struct view *view, enum request request);
-static bool
-find_next_line(struct view *view, unsigned long lineno, struct line *line)
+static void
+select_view_line(struct view *view, unsigned long lineno)
{
assert(view_is_displayed(view));
- if (!view->ops->grep(view, line))
- return FALSE;
-
if (lineno - view->offset >= view->height) {
view->offset = lineno;
view->lineno = lineno;
redrawwin(view->win);
wrefresh(view->win);
}
-
- report("Line %ld matches '%s'", lineno + 1, view->grep);
- return TRUE;
}
static void
/* Note, lineno is unsigned long so will wrap around in which case it
* will become bigger than view->lines. */
for (; lineno < view->lines; lineno += direction) {
- struct line *line = &view->line[lineno];
-
- if (find_next_line(view, lineno, line))
+ if (view->ops->grep(view, &view->line[lineno])) {
+ select_view_line(view, lineno);
+ report("Line %ld matches '%s'", lineno + 1, view->grep);
return;
+ }
}
report("No match found for '%s'", view->grep);