the letter "m".
- "xyattr" - when "render-line:findxy" is handled, the attributes that
were in effect that the found position are made available as "xyattr".
-- "cached-size" - when measuring an image with the "noupscale" attribute
- this will be set to "width"x"height". This is primarily for internal
- use.
- "line-height" - when measuring text, this is set to the height of the
line. When the line is wrapped this will be an integer submultiple of
the resulting pane height. When text is not wrapped it will be
following punctuation (=) and try there.
- [ ] resolve shift-left vs shift_left distinction - add a "fixed" suffix?
- [ ] should zoom affect whole window, not just pane?
-- [ ] ditch cached-size for images - store in pane data instead.
+- [X] ditch cached-size for images - store in pane data instead.
- [ ] use foreach_attr for parsing image details
- [ ] mergeview command to show diff between "found" and "replacement".
- [ ] mergeview command to include both found and replacement, discard
bool image;
int curspos;
+ struct xy image_size;
/* These used to check is measuring is needed, or to record
* results of last measurement */
unsigned short measure_width, measure_height;
return;
}
rd->image = strstarts(line, SOH "image:");
- if (rd->image)
+ if (rd->image) {
+ rd->image_size.x = 0;
return;
+ }
buf_init(&attr);
buf_init(&wrapattr);
int dodraw,
int offset, int want_xypos, short x, short y)
{
+ struct rline_data *rd = &p->data;
char *fname = NULL;
const char *orig_line = line;
short width, height;
int ioffset;
struct xy xyscale = pane_scale(focus);
int scale = xyscale.x;
- char *ssize = attr_find(p->attrs, "cached-size");
struct xy size= {-1, -1};
if (dodraw)
int len = strcspn(line, "," STX ETX);
if (strstarts(line, "image:")) {
fname = strndup(line+6, len-6);
- if (!ssize ||
- sscanf(ssize, "%hdx%hd", &size.x, &size.y) != 2) {
+ if (rd->image_size.x <= 0) {
struct call_return cr =
home_call_ret(all, focus,
"Draw:image-size",
if (cr.x > 0 && cr.y > 0) {
size.x = cr.x;
size.y = cr.y;
- asprintf(&ssize, "%hdx%hd",
- cr.x, cr.y);
- attr_set_str(&p->attrs,
- "cached-size", ssize);
+ rd->image_size = size;
}
- }
+ } else
+ size = rd->image_size;
} else if (strstarts(line, "width:")) {
width = atoi(line + 6);
width = width * scale / 1000;