return ret & 0xfffff;
}
+wint_t mark_step_pane(struct pane *p, struct mark *m, int forward, int move, struct cmd_info *ci)
+{
+ int ret = call5("doc:step", p, forward, m, NULL, move);
+
+ if (ret <= 0)
+ return ret;
+ if (ret >= 0x1fffff)
+ return WEOF;
+ else
+ return ret & 0xfffff;
+}
+
wint_t mark_step2(struct doc *d, struct mark *m, int forward, int move)
{
struct cmd_info ci = {0};
return ret;
}
+wint_t mark_next_pane(struct pane *p, struct mark *m)
+{
+ wint_t ret;
+ struct mark *m2 = NULL;
+ struct cmd_info same_ci = {0};
+
+ while ((m2 = doc_next_mark_all(m)) != NULL &&
+ mark_same_pane(p, m, m2, &same_ci))
+ mark_forward_over(m, m2);
+
+ ret = mark_step_pane(p, m, 1, 1, NULL);
+ if (ret == WEOF)
+ return ret;
+
+/* FIXME do I need to do this - is it precise enough? */
+ while ((m2 = doc_next_mark_all(m)) != NULL &&
+ mark_same_pane(p, m, m2, &same_ci))
+ mark_forward_over(m, m2);
+ return ret;
+}
+
wint_t mark_prev(struct doc *d, struct mark *m)
{
wint_t ret;
return ret;
}
+wint_t mark_prev_pane(struct pane *p, struct mark *m)
+{
+ wint_t ret;
+ struct mark *mp = NULL;
+ struct cmd_info same_ci = {0};
+
+ while ((mp = doc_prev_mark_all(m)) != NULL &&
+ mark_same_pane(p, m, mp, &same_ci))
+ mark_backward_over(m, mp);
+
+ ret = mark_step_pane(p, m, 0, 1, NULL);
+ if (ret == WEOF)
+ return ret;
+ while ((mp = doc_prev_mark_all(m)) != NULL &&
+ mark_same_pane(p, m, mp, &same_ci))
+ mark_backward_over(m, mp);
+ return ret;
+}
+
/* Move the point so it is at the same location as the mark, both in the
* text.
* Firstly find the point closest to the mark, though that will often
wint_t mark_step2(struct doc *d, struct mark *m, int forward, int move);
wint_t mark_next(struct doc *d, struct mark *m);
wint_t mark_prev(struct doc *d, struct mark *m);
+wint_t mark_next_pane(struct pane *p, struct mark *m);
+wint_t mark_prev_pane(struct pane *p, struct mark *m);
struct mark *mark_at_point(struct pane *p, struct mark *pm, int view);
struct mark *do_mark_at_point(struct doc *d, struct mark *pt, int view);
void points_resize(struct doc *d);
DEF_CMD(search_add)
{
struct es_info *esi = ci->home->data;
- struct doc *d = doc_from_pane(esi->target);
wint_t wch;
char b[5];
mbstate_t ps = {0};
int l;
- if (!d)
- return -1;
do {
/* TEMP HACK - please fix */
doc_set_attr(esi->target, esi->end, "highlight", NULL);
- wch = mark_next(d, esi->end);
+ wch = mark_next_pane(esi->target, esi->end);
if (wch == WEOF)
return 1;
if (wch == '\n') {
/* Sending this will cause a call-back to
* close everything down.
*/
- mark_prev(d, esi->end);
+ mark_prev_pane(esi->target, esi->end);
return 1;
}
/* FIXME utf-8! and quote regexp chars */