Don't use ci for returing things.
As a char could be zero and WEOF could appear negative,
use high bits to make the number look positive.
Signed-off-by: NeilBrown <neil@brown.name>
struct mark *m = ci->mark;
bool forward = ci->numeric;
bool move = ci->extra;
+ int ret;
struct pane *p = m->ref.p, *next;
if (move)
m->ref.p = next;
if (p == NULL)
- ci->extra = WEOF;
+ ret = WEOF;
else
- ci->extra = ' ';
- return 1;
+ ret = ' ';
+ /* return value must be +ve, so use high bits to ensure this. */
+ return (ret & 0xFFFFF) | 0x100000;
}
DEF_CMD(docs_set_ref)
wint_t mark_step(struct doc *d, struct mark *m, int forward, int move, struct cmd_info *ci)
{
- return call_extra("doc:step", d->home, forward, m, move);
+ int ret = call5("doc:step", d->home, 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)
}
if (move && ret != WEOF)
m->ref.d = d;
- ci->extra = ret;
- return 1;
+ /* return value must be +ve, so use high bits to ensure this. */
+ return (ret & 0xFFFFF) | 0x100000;
}
DEF_CMD(dir_set_ref)
ret = text_prev(t, &r);
if (ret != WEOF && move)
m->ref = *(struct doc_ref*)&r;
- ci->extra = ret;
- return 1;
+ /* return value must be +ve, so use high bits to ensure this. */
+ return (ret & 0xFFFFF) | 0x100000;
}
static int text_ref_same(struct text *t, struct doc_ref *r1, struct doc_ref *r2)