{
}
-static int docs_reundo(struct point *p, bool redo)
-{
- return 0;
-}
-
static wint_t docs_step(struct doc *doc, struct mark *m, bool forward, bool move)
{
struct doc *d = m->ref.d, *next;
static struct doc_operations docs_ops = {
.replace = docs_replace,
- .reundo = docs_reundo,
.step = docs_step,
.same_ref = docs_sameref,
.get_attr = docs_get_attr,
struct doc_operations {
void (*replace)(struct point *pos, struct mark *end,
char *str, bool *first);
- int (*reundo)(struct point *pos, bool undo);
wint_t (*step)(struct doc *d, struct mark *m, bool forward, bool move);
int (*same_ref)(struct doc *d, struct mark *a, struct mark *b);
/* get/set attr operate on the attributes of the char immediately
}
static inline int doc_undo(struct point *p, bool redo)
{
- return p->doc->ops->reundo(p, redo);
+ struct cmd_info ci = {0};
+ ci.pointp = &p;
+ ci.numeric = redo ? 1 : 0;
+ ci.key = "doc:reundo";
+ return key_lookup(p->doc->map, &ci);
}
static inline int doc_load_file(struct doc *d, struct point *p,
int fd, char *name)
return 1;
}
-static int dir_reundo(struct point *p, bool redo)
-{
- return 0;
-}
-
static wint_t dir_step(struct doc *doc, struct mark *m, bool forward, bool move)
{
struct directory *dr = container_of(doc, struct directory, doc);
static struct doc_operations dir_ops = {
.replace = dir_replace,
- .reundo = dir_reundo,
.step = dir_step,
.same_ref = dir_sameref,
.get_attr = dir_get_attr,
return 2;
}
-static int text_reundo(struct point *p, bool redo)
+DEF_CMD(text_reundo)
{
+ struct point *p = *ci->pointp;
+ bool redo = ci->numeric != 0;
struct doc_ref start, end;
int did_do = 2;
bool first = 1;
static struct doc_operations text_ops = {
.replace = text_replace,
- .reundo = text_reundo,
.step = text_step,
.same_ref = text_sameref,
.get_attr = text_get_attr,
key_add(text_map, "doc:destroy", &text_destroy);
key_add(text_map, "doc:set-ref", &text_set_ref);
key_add(text_map, "doc:save-file", &text_save_file);
+ key_add(text_map, "doc:reundo", &text_reundo);
}