static int flush_line(struct pane *p safe, struct pane *focus safe, int dodraw,
struct render_list **rlp safe,
- int y, int scale, int wrap_pos,
+ int y, int scale, int wrap_pos, int *wrap_margin safe,
const char **xypos, const char **xyattr)
{
/* Flush a render_list returning x-space used.
for (rl = *rlp; rl && rl != last_wrap; rl = rl->next) {
int cp = rl->cursorpos;
+ if (!*wrap_margin && strstr(rl->attr, "wrap-margin,"))
+ *wrap_margin = rl->x;
+
if (wrap_pos &&
cp >= (int)strlen(rl->text) + wrap_len)
/* Don't want to place cursor at end of line before
*rlp = end_wrap;
/* Queue the wrap-head for the next flush */
- if (wrap_pos && last_rl &&
- (head = get_last_attr(last_rl->attr, "wrap-head"))) {
- struct call_return cr =
- home_call_ret(all, focus, "Draw:text-size", p,
- p->w, NULL, head,
- scale, NULL, last_rl->attr);
- rl = calloc(1, sizeof(*rl));
- rl->text = head;
- rl->attr = strdup(last_rl->attr); // FIXME underline,fg:blue ???
- rl->width = cr.x;
- rl->x = 0;
- rl->cursorpos = -1;
- rl->next = *rlp;
- *rlp = rl;
- /* 'x' is how much to shift-left remaining rl entries,
- * Don't want to shift them over the wrap-head
- */
- x -= cr.x;
+ if (wrap_pos && last_rl) {
+ head = get_last_attr(last_rl->attr, "wrap-head");
+ if (head) {
+ struct call_return cr =
+ home_call_ret(all, focus, "Draw:text-size", p,
+ p->w, NULL, head,
+ scale, NULL, last_rl->attr);
+ rl = calloc(1, sizeof(*rl));
+ rl->text = head;
+ rl->attr = strdup(last_rl->attr); // FIXME underline,fg:blue ???
+ rl->width = cr.x;
+ rl->x = *wrap_margin;
+ rl->cursorpos = -1;
+ rl->next = *rlp;
+ *rlp = rl;
+ /* 'x' is how much to shift-left remaining rl entries,
+ * Don't want to shift them over the wrap-head
+ */
+ x -= cr.x;
+ }
+ x -= *wrap_margin;
}
for (rl = tofree; rl && rl != end_wrap; rl = tofree) {
struct buf attr;
unsigned char ch;
int wrap_offset = 0; /*number of columns displayed in earlier lines */
+ int wrap_margin = 0; /* left margin for wrap */
int in_tab = 0;
int shift_left = atoi(pane_attr_get(focus, "shift_left") ?:"0");
int wrap = shift_left < 0;
if (wrap && *line && *line != '\n') {
int len = flush_line(p, focus, dodraw, &rlst,
y+ascent, scale,
- p->w - mwidth,
+ p->w - mwidth, &wrap_margin,
&xypos, &xyattr);
wrap_offset += len;
x -= len;
if (ch == '\n') {
xypos = line-1;
flush_line(p, focus, dodraw, &rlst, y+ascent, scale, 0,
- &xypos, &xyattr);
+ &wrap_margin, &xypos, &xyattr);
y += line_height;
x = 0;
wrap_offset = 0;
}
flush_line(p, focus, dodraw, &rlst, y+ascent, scale, 0,
- &xypos, &xyattr);
+ &wrap_margin, &xypos, &xyattr);
if (want_xypos == 1) {
rd->xyattr = xyattr ? strdup(xyattr) : NULL;
self["line-format"] = ("<%BG><%TM-hilite>%TM-date_relative</>" +
"<tab:130> <fg:blue>%TM-authors</>" +
"<tab:350>%TM-size%TM-threadinfo<%TM-hilite>" +
- "<fg:red,bold>%TM-flag</> %TM-subject</></>")
+ "<fg:red,bold>%TM-flag</> <wrap-margin>%TM-subject</></>")
self.add_notify(self.maindoc, "Notify:Tag")
self.add_notify(self.maindoc, "Notify:Close")
self['doc-status'] = ""
def __init__(self, focus):
edlib.Pane.__init__(self, focus)
self['notmuch:pane'] = 'main'
- self['render-wrap'] = 'no'
self['background'] = 'color:#A0FFFF'
self['line-format'] = '<%fmt>%count%space%name</>'
self.call("notmuch:set_list_pane")
def render_query_attach(key, focus, comm2, **a):
p = notmuch_query_view(focus)
p = p.call("attach-render-format", ret='pane')
+ p['render-wrap'] = 'yes'
if comm2:
comm2("callback", p)
return 1