commit - bf9925817290154a1c33106d3ca0630c60729689
commit + 768db5bbee1653c1c07e828c8916203efde2e2d9
blob - bd7a428603870c036454b67c15c3f64185a7c17d
blob + fe1d633c43f21736cbddecf548a320b06cab4d39
--- ui.c
+++ ui.c
static int kbd(const char*);
static void kmap_define_key(struct kmap*, const char*, void(*)(struct tab*));
static void load_default_keys(void);
-static int push_line(struct tab*, const struct line*, const char*, size_t);
+static int push_line(struct tab*, const struct line*, const char*, size_t, int);
static void empty_vlist(struct tab*);
static void restore_cursor(struct tab *);
}
static int
-push_line(struct tab *tab, const struct line *l, const char *buf, size_t len)
+push_line(struct tab *tab, const struct line *l, const char *buf, size_t len, int cont)
{
struct line *vl;
if (len != 0)
memcpy(vl->line, buf, len);
vl->alt = l->alt;
+ vl->flags = cont;
if (TAILQ_EMPTY(&tab->s->head))
TAILQ_INSERT_HEAD(&tab->s->head, vl, lines);
static inline int
emitline(struct tab *tab, size_t zero, size_t *off, const struct line *l,
- const char **line)
+ const char **line, int *cont)
{
- if (!push_line(tab, l, *line, *off - zero))
+ if (!push_line(tab, l, *line, *off - zero, *cont))
return 0;
+ if (!*cont)
+ *cont = 1;
*line += *off - zero;
*off = zero;
return 1;
wrap_text(struct tab *tab, const char *prfx, struct line *l)
{
size_t zero, off, len, split;
+ int cont = 0;
const char *endword, *endspc, *line, *linestart;
zero = strlen(prfx);
while (word_boundaries(line, " \t-", &endword, &endspc)) {
len = endword - line;
if (off + len >= body_cols) {
- emitline(tab, zero, &off, l, &linestart);
+ emitline(tab, zero, &off, l, &linestart, &cont);
while (len >= body_cols) {
/* hard wrap */
- emitline(tab, zero, &off, l, &linestart);
+ emitline(tab, zero, &off, l, &linestart, &cont);
len -= body_cols-1;
line += body_cols-1;
}
/* line = endspc; */
if (off != zero) {
if (off + len >= body_cols) {
- emitline(tab, zero, &off, l, &linestart);
+ emitline(tab, zero, &off, l, &linestart, &cont);
linestart = endspc;
} else
off += len;
line = endspc;
}
- emitline(tab, zero, &off, l, &linestart);
+ emitline(tab, zero, &off, l, &linestart, &cont);
}
static int
hardwrap_text(struct tab *tab, struct line *l)
{
size_t off, len;
+ int cont;
const char *linestart;
if (l->line == NULL)
- return emitline(tab, 0, &off, l, &linestart);
+ return emitline(tab, 0, &off, l, &linestart, &cont);
len = strlen(l->line);
off = 0;
while (len >= COLS) {
len -= COLS-1;
off = COLS-1;
- if (!emitline(tab, 0, &off, l, &linestart))
+ if (!emitline(tab, 0, &off, l, &linestart, &cont))
return 0;
}
if (len != 0)
- return emitline(tab, 0, &len, l, &linestart);
+ return emitline(tab, 0, &len, l, &linestart, &cont);
return 1;
}
break;
case LINE_PRE_START:
case LINE_PRE_END:
- push_line(tab, l, NULL, 0);
+ push_line(tab, l, NULL, 0, 0);
break;
case LINE_PRE_CONTENT:
hardwrap_text(tab, l);
print_line(struct line *l)
{
const char *text = l->line;
- const char *prfx = line_prefixes[l->type].prfx1;
+ const char *prfx;
int face = line_faces[l->type].prop;
+ if (!l->flags)
+ prfx = line_prefixes[l->type].prfx1;
+ else
+ prfx = line_prefixes[l->type].prfx2;
+
if (text == NULL)
text = "";