示例#1
0
static size_t op_replace(Vis *vis, Text *txt, OperatorContext *c) {
	size_t count = 0;
	Iterator it = text_iterator_get(txt, c->range.start);
	while (it. pos < c->range.end && text_iterator_char_next(&it, NULL))
		count++;
	op_delete(vis, txt, c);
	size_t pos = c->range.start;
	for (size_t len = strlen(c->arg->s); count > 0; pos += len, count--)
		text_insert(txt, pos, c->arg->s, len);
	return pos;
}
示例#2
0
static size_t op_change(Vis *vis, Text *txt, OperatorContext *c) {
	op_delete(vis, txt, c);
	macro_operator_record(vis);
	return c->range.start;
}