Download raw body.
tog: "search wrapped" notifications
In continuation of this thread:
https://marc.info/?l=gameoftrees&m=167606517310115&w=2
Inlined patch adds "search wrapped" and "diff navigation wrapped" for
searches and file/hunk diff navigation.
It also makes the notification highlighted with wstandout(), since in my
testing on large screen it helps to notice the wrap arounds.
diff /home/misha/work/got
commit - 79cd0a74be4fd59c3cbfc4f35772ba4336b950be
path + /home/misha/work/got
blob - 09cd112bc1ff0346edd8a4dd37b64c38e1d41113
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -1596,7 +1596,9 @@ action_report(struct tog_view *view)
wmove(v->window, v->nlines - 1, 0);
wclrtoeol(v->window);
+ wstandout(v->window);
wprintw(v->window, ":%s", view->action);
+ wstandend(v->window);
wrefresh(v->window);
/*
@@ -5281,6 +5283,8 @@ search_next_view_match(struct tog_view *view)
break;
}
+ view->action = "search wrapped";
+
if (view->searching == TOG_SEARCH_FORWARD)
lineno = 1;
else
@@ -5570,15 +5574,18 @@ diff_prev_index(struct tog_diff_view_state *s, enum go
}
static void
-diff_prev_index(struct tog_diff_view_state *s, enum got_diff_line_type type)
+diff_prev_index(struct tog_view *view, struct tog_diff_view_state *s,
+ enum got_diff_line_type type)
{
int start, i;
i = start = s->first_displayed_line - 1;
while (s->lines[i].type != type) {
- if (i == 0)
+ if (i == 0) {
+ view->action = "diff navigation wrapped";
i = s->nlines - 1;
+ }
if (--i == start)
return; /* do nothing, requested type not in file */
}
@@ -5588,15 +5595,18 @@ diff_next_index(struct tog_diff_view_state *s, enum go
}
static void
-diff_next_index(struct tog_diff_view_state *s, enum got_diff_line_type type)
+diff_next_index(struct tog_view *view, struct tog_diff_view_state *s,
+ enum got_diff_line_type type)
{
int start, i;
i = start = s->first_displayed_line + 1;
while (s->lines[i].type != type) {
- if (i == s->nlines - 1)
+ if (i == s->nlines - 1) {
+ view->action = "diff navigation wrapped";
i = 0;
+ }
if (++i == start)
return; /* do nothing, requested type not in file */
}
@@ -5721,16 +5731,16 @@ input_diff_view(struct tog_view **new_view, struct tog
free(line);
break;
case '(':
- diff_prev_index(s, GOT_DIFF_LINE_BLOB_MIN);
+ diff_prev_index(view, s, GOT_DIFF_LINE_BLOB_MIN);
break;
case ')':
- diff_next_index(s, GOT_DIFF_LINE_BLOB_MIN);
+ diff_next_index(view, s, GOT_DIFF_LINE_BLOB_MIN);
break;
case '{':
- diff_prev_index(s, GOT_DIFF_LINE_HUNK);
+ diff_prev_index(view, s, GOT_DIFF_LINE_HUNK);
break;
case '}':
- diff_next_index(s, GOT_DIFF_LINE_HUNK);
+ diff_next_index(view, s, GOT_DIFF_LINE_HUNK);
break;
case '[':
if (s->diff_context > 0) {
@@ -7637,6 +7647,7 @@ search_next_tree_view(struct tog_view *view)
te = got_object_tree_get_first_entry(s->tree);
else
te = got_object_tree_get_last_entry(s->tree);
+ view->action = "search wrapped";
}
if (match_tree_entry(te, &view->regex)) {
@@ -8398,6 +8409,7 @@ search_next_ref_view(struct tog_view *view)
re = TAILQ_FIRST(&s->refs);
else
re = TAILQ_LAST(&s->refs, tog_reflist_head);
+ view->action = "search wrapped";
}
if (match_reflist_entry(re, &view->regex)) {
tog: "search wrapped" notifications