return ret;
}
-int render_attach(char *name, struct pane *parent)
+struct pane *render_attach(char *name, struct pane *parent)
{
char buf[100];
struct cmd_info ci = {0};
parent = pane_final_child(parent);
ptp = pane_point(parent);
if (!ptp)
- return 0;
+ return NULL;
if (!name)
name = (*ptp)->doc->default_render;
ci.pointp = ptp;
ret = key_lookup(pane2ed(parent)->commands, &ci);
if (ret)
- return ret;
+ return ci.focus;
sprintf(buf, "render-%s", name);
editor_load_module(pane2ed(parent), buf);
sprintf(buf, "render-%s-attach", name);
- return key_lookup(pane2ed(parent)->commands, &ci);
+ ret = key_lookup(pane2ed(parent)->commands, &ci);
+ if (ret)
+ return ci.focus;
+ return NULL;
}
void doc_promote(struct doc *d);
int doc_destroy(struct doc *d);
-int render_attach(char *name, struct pane *parent);
+struct pane *render_attach(char *name, struct pane *parent);
/* Points and Marks */
};
static struct map *dr_map;
-static void do_render_dir_attach(struct pane *parent, struct point **ptp);
+static struct pane *do_render_dir_attach(struct pane *parent, struct point **ptp);
static int put_str(struct pane *p, char *buf, char *attrs, int x, int y)
{
key_add(dr_map, "Chr-g", &render_dir_reload);
}
-static void do_render_dir_attach(struct pane *parent, struct point **ptp)
+static struct pane *do_render_dir_attach(struct pane *parent, struct point **ptp)
{
struct dir_data *dd = malloc(sizeof(*dd));
struct pane *p;
if (!ptp)
ptp = pane_point(parent);
if (!ptp)
- return;
+ return NULL;
dd->top = NULL;
dd->bot = NULL;
dd->ignore_point = 0;
if (!dr_map)
render_dir_register_map();
+ return p;
}
DEF_CMD(render_dir_attach)
{
- do_render_dir_attach(ci->focus, ci->pointp);
+ ci->focus = do_render_dir_attach(ci->focus, ci->pointp);
return 1;
}
render_format_attach_func(ci);
c = pane_child(ci->home);
if (c)
- return pane_clone(c, pane_child(ci->focus));
+ return pane_clone(c, ci->focus);
return 1;
}
if (!rf_map)
render_format_register_map();
+ ci->focus = p;
return 1;
}
};
static struct map *he_map;
-static void do_render_hex_attach(struct pane *parent, struct point **ptp);
+static struct pane *do_render_hex_attach(struct pane *parent, struct point **ptp);
DEF_CMD(render_hex_handle)
{
key_add(he_map, "render-line", &render_line);
}
-static void do_render_hex_attach(struct pane *parent, struct point **ptp)
+static struct pane *do_render_hex_attach(struct pane *parent, struct point **ptp)
{
struct he_data *he = malloc(sizeof(*he));
struct pane *p;
if (!ptp)
ptp = pane_point(parent);
if (!ptp)
- return;
+ return NULL;
he->type = render_hex_notify;
he->typenum = doc_add_view((*ptp)->doc, &he->type);
if (!he_map)
render_hex_register_map();
+ return p;
}
DEF_CMD(render_hex_attach)
{
- do_render_hex_attach(ci->focus, ci->pointp);
+ ci->focus = do_render_hex_attach(ci->focus, ci->pointp);
return 1;
}
if (!rl_map)
render_lines_register_map();
+ ci->focus = rl->pane;
return 1;
}
};
static struct map *rt_map;
-static void do_render_text_attach(struct pane *p, struct point **pt);
+static struct pane *do_render_text_attach(struct pane *p, struct point **pt);
static int rt_fore(struct doc *d, struct pane *p, struct mark *m, int *x, int *y, int draw)
{
key_add(rt_map, "Replace", &render_text_follow_point);
}
-static void do_render_text_attach(struct pane *parent, struct point **ptp)
+static struct pane *do_render_text_attach(struct pane *parent, struct point **ptp)
{
struct rt_data *rt = malloc(sizeof(*rt));
struct pane *p;
if (!ptp)
ptp = pane_point(parent);
if (!ptp)
- return;
+ return NULL;
rt->top = NULL;
rt->bot = NULL;
rt->ignore_point = 0;
if (!rt_map)
render_text_register_map();
+ return p;
}
DEF_CMD(render_text_attach)
{
- do_render_text_attach(ci->focus, ci->pointp);
+ ci->focus = do_render_text_attach(ci->focus, ci->pointp);
return 1;
}