*/
struct pane *line safe, *child;
struct pane *log;
- int height; /* height of line */
- int ascent; /* how far down to baseline */
int hidden;
time_t last_message; /* message should stay for at least 10 seconds */
};
static struct pane *do_messageline_attach(struct pane *p safe);
-static struct map *messageline_map, *messageline_line_map;
+static struct map *messageline_map;
DEF_LOOKUP_CMD(messageline_handle, messageline_map);
-DEF_LOOKUP_CMD(messageline_line_handle, messageline_line_map);
-
-static void pane_str(struct pane *p safe, char *s, char *attr, int x, int y)
-{
- call("Draw:text", p, -1, NULL, s, 0, NULL, attr, x, y);
-}
DEF_CMD(messageline_clone)
{
0, NULL, ci->str);
}
time(&mli->last_message);
- pane_damaged(mli->line, DAMAGED_REFRESH);
+ pane_damaged(ci->home, DAMAGED_VIEW);
}
if (strcmp(ci->key, "Message:broadcast") == 0)
return 1; /* Acknowledge message */
free(mli->modal);
mli->modal = NULL;
time(&mli->last_message);
- pane_damaged(mli->line, DAMAGED_REFRESH);
+ pane_damaged(ci->home, DAMAGED_VIEW);
return Efallthrough;
}
DEF_CMD(messageline_refresh_size)
{
struct mlinfo *mli = ci->home->data;
- if (mli->height == 0) {
- struct call_return cr =
- call_ret(all, "Draw:text-size", ci->home, -1, NULL, "M",
- 0, NULL, "bold");
- mli->height = cr.y;
- mli->ascent = cr.i2;
- }
+ struct pane *p = mli->line;
if (mli->hidden) {
- pane_resize(mli->line, 0, ci->home->h,
- ci->home->w, mli->height);
+ pane_resize(p, 0, ci->home->h,
+ ci->home->w, ci->home->h / 3);
if (mli->child)
pane_resize(mli->child, 0, 0,
ci->home->w, ci->home->h);
} else {
- pane_resize(mli->line, 0, ci->home->h - mli->height,
- ci->home->w, mli->height);
- if (mli->child && ci->home->h > mli->height)
+ pane_resize(p, p->x, p->y, ci->home->w, ci->home->h/3);
+ call("render-line:measure", p);
+ pane_resize(p, p->x, ci->home->h - p->h,
+ ci->home->w, p->h);
+ if (mli->child && ci->home->h > p->h)
pane_resize(mli->child, 0, 0,
ci->home->w,
- ci->home->h - mli->height);
+ ci->home->h - p->h);
}
- pane_damaged(ci->home, DAMAGED_REFRESH);
- pane_damaged(mli->line, DAMAGED_REFRESH);
+ pane_damaged(p, DAMAGED_REFRESH);
return 1;
}
mli->modal = NULL;
if (mli->message)
mli->last_message = time(NULL);
- pane_damaged(mli->line, DAMAGED_REFRESH);
+ pane_damaged(ci->home, DAMAGED_VIEW);
}
if (mli->message &&
time(NULL) >= mli->last_message + wait_time) {
free(mli->message);
mli->message = NULL;
- pane_damaged(mli->line, DAMAGED_REFRESH);
+ pane_damaged(ci->home, DAMAGED_VIEW);
}
if (!mli->message && !mli->modal) {
pane_drop_notifiers(ci->home, "Keystroke-notify");
return 1;
}
-DEF_CMD(messageline_line_refresh)
+static void pane_str(struct pane *p safe, char *s, char *attr)
+{
+ struct mlinfo *mli = p->parent->data;
+ char *l = strconcat(p, SOH, attr, STX, s, ETX);
+ call("render-line:set", p, -1, NULL, l);
+ /* Allow message line to use up to 1/3 of total height */
+ pane_resize(p, p->x, p->y, p->w, p->parent->h/3);
+ call("render-line:measure", p);
+ if (!mli->hidden) {
+ pane_resize(p, p->x, p->parent->h - p->h, p->w, p->h);
+ if (mli->child) {
+ struct pane *c = mli->child;
+ pane_resize(c, 0, 0, c->w, p->parent->h - p->h);
+ }
+ }
+}
+
+DEF_CMD(messageline_refresh)
{
struct mlinfo *mli = ci->home->data;
- call("Draw:clear", mli->line, 0, NULL, "bg:white");
if (mli->message && !mli->modal &&
time(NULL) >= mli->last_message + 30) {
free(mli->message);
pane_drop_notifiers(ci->home, "Mouse-event-notify");
}
if (mli->modal)
- pane_str(mli->line, mli->modal, "bold,fg:magenta-60,bg:white",
- 0, 0 + mli->ascent);
+ pane_str(mli->line, mli->modal, "bold,fg:magenta-60,bg:white");
else if (mli->message)
- pane_str(mli->line, mli->message, "bold,fg:red,bg:cyan",
- 0, 0 + mli->ascent);
+ pane_str(mli->line, mli->message, "bold,fg:red,bg:cyan");
else {
char buf[80];
time_t t;
strftime(buf, sizeof(buf), "%H:%M %d-%b-%Y", tm);
else
buf[0] = 0;
- pane_str(mli->line, buf, "bold,fg:blue",
- 0, 0 + mli->ascent);
+ pane_str(mli->line, buf, "bold,fg:blue");
}
return 1;
}
DEF_CMD(force_refresh)
{
- pane_damaged(ci->home, DAMAGED_REFRESH);
+ pane_damaged(ci->home, DAMAGED_VIEW);
return 1;
}
return NULL;
call("editor:request:Message:broadcast", ret);
/* z=1 to avoid clone_children affecting it */
- mlp = pane_register(ret, 1, &messageline_line_handle.c, mli);
+ mlp = call_ret(pane, "attach-renderline", ret, 1);
if (!mlp) {
pane_close(ret);
return NULL;
}
+ /* Support wrapping */
+ attr_set_int(&mlp->attrs, "shift_left", -1);
+ pane_damaged(ret, DAMAGED_VIEW);
mli->line = mlp;
pane_focus(ret);
if (!edlib_testing(p))
/* This can introduce unwanted variablitiy in tests */
- call_comm("event:timer", mli->line, &force_refresh, 15000);
+ call_comm("event:timer", ret, &force_refresh, 15000);
mli->log = call_ret(pane, "docs:byname", p, 0, NULL, "*Messages*");
if (!mli->log)
- mli->log = call_ret(pane, "log:create", p, 0, NULL,
+ mli->log = call_ret(pane, "log:create", ret, 0, NULL,
"*Messages*");
return ret;
key_add(messageline_map, "Child-Notify",&messageline_child_notify);
key_add(messageline_map, "Keystroke-notify", &messageline_notify);
key_add(messageline_map, "Mouse-event-notify", &messageline_notify);
-
- messageline_line_map = key_alloc();
- key_add(messageline_line_map, "Refresh", &messageline_line_refresh);
+ key_add(messageline_map, "Refresh:view", &messageline_refresh);
}
Key ":A--"
Display 80,30 13DD8B4A5B03CB54BBC9CC65CCB10272 20,0
Key ":A-;"
-Display 80,30 F54DBC70726E98A2913EC0407C1B7ABC 8,5
+Display 80,30 187C12D6F0237E56AC725675C438D35D 8,5
Key "-0"
-Display 80,30 0F01FA025124C1D7428D977AD07E4BEF 9,8
+Display 80,30 C60B776C161AC49D15E0B343E3A80200 9,8
Key "-1"
-Display 80,30 E99CC0667BF4D51F70A00603488D7966 68,8
+Display 80,30 A7E960EF28E8FBEF8CE1D3934F114A8D 68,8
Key "-2"
-Display 80,30 0D4F4437FB62A61B5447187A217BD5B3 8,15
+Display 80,30 FBDF992D22B009C514FDF2D2FDDCA4D7 8,15
Key "-0"
-Display 80,30 75251A2017C61E2DE0A05ECD9DD5C7A0 13,18
+Display 80,30 043355AE1F8D1C60B714F84CAC2051DB 13,18
Key "-1"
-Display 80,30 D3EC505D9F645F71622B46D6B1764BE1 30,23
+Display 80,30 736A56D79B465AA8A1BACE1DBC411CF9 30,22
Key "- "
-Display 80,30 9A79A279F4348B4A1A24A13407C97211 6,25
+Display 80,30 CAA9CDFD50E6851E95BAC003879567A1 6,21
Key "- "
-Display 80,30 25A416536F894D9F370AC7FB951E449B 59,27
-Display 80,30 077B6F221D9986860543469734275599 59,27
+Display 80,30 5E0A22C09D987BE6C6C07940B9B0E578 59,24
Key ":Enter"
-Display 80,30 2EC831068E8DF773F9B5DF3EC997999E 59,27
+Display 80,30 0F4F95C15DA7193E6417004D2E499978 59,24
Key ":C-X"
-Display 80,30 5E26219ECB9E5DDA49D0CD1B5F90FFA2 59,27
+Display 80,30 9599A4BF3962C00266BB8CF8D9AB3088 59,24
Key ":C-S"
-Display 80,30 EAF91CE03C40FCE8DDB5D6FEA4E0052D 59,27
+Display 80,30 15D263B1D5B3FDF5F97D3428BAC8D27A 59,24
Key ":C-X"
-Display 80,30 C60DD4C6AF97BED906B64520D5A4A0D2 59,27
+Display 80,30 4EEC8A848EC8816669FCC7D1F8E9717F 59,24
Key ":C-C"
-Display 80,30 7D8FEE03B08CF6048D8C702DD641B86C 59,27
-Close 475
+Display 80,30 DB7F73E268B8F087996B4A4574F042E3 59,24
+Close 606