From: NeilBrown Date: Thu, 26 Nov 2015 23:52:32 +0000 (+1100) Subject: doc_attr: pass pane instead of doc X-Git-Tag: lca2016~173 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=ef66a494c3bec33e2a5e72cdea1c72d0c9f82a37;p=edlib.git doc_attr: pass pane instead of doc Signed-off-by: NeilBrown --- diff --git a/core-doc.c b/core-doc.c index a6ef5494..2c2b59b5 100644 --- a/core-doc.c +++ b/core-doc.c @@ -680,7 +680,7 @@ static char *__docs_get_attr(struct doc *doc, struct mark *m, d = p->data; if (strcmp(attr, "name") == 0) return d->name; - return doc_attr(d, NULL, 0, attr); + return doc_attr(p, NULL, 0, attr); } DEF_CMD(docs_get_attr) diff --git a/core-pane.c b/core-pane.c index 4ec81d35..c18f1776 100644 --- a/core-pane.c +++ b/core-pane.c @@ -507,7 +507,7 @@ char *pane_attr_get(struct pane *p, char *key) if (a) return a; if (p->point) { - a = doc_attr(p->point->doc, NULL, 0, key); + a = doc_attr(p, NULL, 0, key); if (a) return a; } diff --git a/core.h b/core.h index bbb9ac9e..b1e79f54 100644 --- a/core.h +++ b/core.h @@ -388,12 +388,12 @@ static inline char *doc_getstr(struct pane *from, struct mark *to) return ci.str; } -static inline char *doc_attr(struct doc *d, struct mark *m, bool forward, char *attr) +static inline char *doc_attr(struct pane *dp, struct mark *m, bool forward, char *attr) { struct cmd_info ci = {0}; ci.key = "doc:get-attr"; - ci.focus = d->home; + ci.focus = dp; ci.mark = m; ci.numeric = forward ? 1 : 0; ci.str = attr; diff --git a/render-format.c b/render-format.c index 9f8f7e66..df63b890 100644 --- a/render-format.c +++ b/render-format.c @@ -97,7 +97,7 @@ DEF_CMD(render_line) buf_append(&ret, ch); continue; } - val = doc_attr(d, m, 1, buf); + val = doc_attr(dp, m, 1, buf); if (!val) val = "-"; if (*n != ':') {