#define MARK_DATA_PTR struct pane
#define _GNU_SOURCE /* for asprintf */
+#define PANE_DATA_TYPE struct rl_data
#include "core.h"
#include "misc.h"
#include <stdio.h> /* snprintf */
*/
struct pane *cursor_pane;
};
+#include "core-pane.h"
static void vmark_clear(struct mark *m safe)
{
free(a);
} else if (strstarts(s, "image:")) {
home_call(focus, "Draw:clear", p);
- home_call(focus, "Draw:image", p, 16, NULL, s+6);
+ home_call(focus, "Draw:image", p, 0, NULL, s+6, 0, NULL, "S");
rl->background_uniform = False;
} else
home_call(focus, "Draw:clear", p, 0, NULL, "");
short lineheight;
if (!cp) {
+ /* Note: this pane will container rl_data
+ * which isn't used.
+ */
cp = pane_register(p, -1, &cursor_handle);
rl->cursor_pane = cp;
}
return 1;
}
-DEF_CMD(render_lines_close)
+DEF_CMD_CLOSED(render_lines_close)
{
struct rl_data *rl = ci->home->data;
return 1;
}
-DEF_CMD(render_lines_close_mark)
+DEF_CMD_CLOSED(render_lines_close_mark)
{
struct mark *m = ci->mark;
;
}
call(tag, focus, 0, m2, xyattr,
- 0, ci->mark, NULL,
+ 0, ci->mark, action,
cih.x, cih.y);
}
m = m2;
tag = get_action_tag(ci->str, attr);
if (!tag)
return Efallthrough;
- call(tag, focus, 0, m, attr);
+ call(tag, focus, 0, m, attr, 0, NULL, ci->str);
return 1;
}
/* top line not fully displayed, being in that line is
* not sufficient */
top = vmark_next(top);
- if (bot)
+ if (bot && rl->tail_height)
/* last line might not be fully displayed, so don't assume */
bot = vmark_prev(bot);
if (!top || !bot ||
num = RPT_NUM(ci);
if (call("doc:EOL", ci->focus, num, m, NULL, 1) <= 0) {
rl->i_moved = 0;
- return Efail;
+ return Efalse;
}
if (RPT_NUM(ci) < 0) {
/* at end of target line, move to start */
if (call("doc:EOL", ci->focus, -1, m) <= 0) {
rl->i_moved = 0;
- return Efail;
+ return Efalse;
}
}
key_add(rl_map, "Close", &render_lines_close);
key_add(rl_map, "Close:mark", &render_lines_close_mark);
- key_add(rl_map, "Free", &edlib_do_free);
key_add(rl_map, "Clone", &render_lines_clone);
key_add(rl_map, "Refresh", &render_lines_refresh);
key_add(rl_map, "Refresh:view", &render_lines_revise);
if (!rl_map)
render_lines_register_map();
- alloc(rl, pane);
- rl->target_x = -1;
- rl->target_y = -1;
- rl->do_wrap = 1;
p = ci->focus;
if (strcmp(ci->key, "attach-render-text") == 0) {
p = call_ret(pane, "attach-markup", p);
if (!p)
p = ci->focus;
}
- p = pane_register(p, 0, &render_lines_handle.c, rl);
- if (!p) {
- free(rl);
+ p = pane_register(p, 0, &render_lines_handle.c);
+ if (!p)
return Efail;
- }
+ rl = p->data;
+ rl->target_x = -1;
+ rl->target_y = -1;
+ rl->do_wrap = 1;
rl->typenum = home_call(ci->focus, "doc:add-view", p) - 1;
call("doc:request:doc:replaced", p);
call("doc:request:doc:replaced-attr", p);