commit - 798e1c954749cdd5b3042212050c8ddae75a9c52
commit + 828b14926efd83e2a4ad1557974e98d87b16e733
blob - bfe716e2534422cfd54bc88659797c8e652bc61f
blob + 7a36c3ef643b5e552ca5cdcc39c2b27453be7be4
--- defaults.c
+++ defaults.c
[LINE_PRE_START] = { "─── ", " " },
[LINE_PRE_CONTENT] = { "", "" },
[LINE_PRE_END] = { "─── ", "" },
+ [LINE_BREAK] = { "", "" },
[LINE_PATCH] = {"", ""},
[LINE_PATCH_HDR] = {"", ""},
.pair = PPEND,
.trail_pair = PPEND_TRAIL,
},
+ [LINE_BREAK] = {
+ .prfx_pair = PB_PRFX,
+ .pair = PB,
+ .trail_pair = PB_TRAIL,
+ },
/* text/x-patch */
[LINE_PATCH] = {
{"pre.start", LINE_PRE_START},
{"pre", LINE_PRE_CONTENT},
{"pre.end", LINE_PRE_END},
+ {"break", LINE_BREAK},
/* text/x-patch */
{"patch", LINE_PATCH},
blob - 3677a37fdf65203a8209a0bbff32432245163cda
blob + 94fd896ef22984ed7ca602e84655c00c896fe2e7
--- parser.c
+++ parser.c
/* drop every "funny" ASCII character */
for (i = 0; i < len; ) {
ch = b[i];
- if ((ch >= ' ' || ch == '\n' || ch == '\t')
+ if ((ch >= ' ' || ch == '\n' || ch == '\t' || ch == '\f')
&& ch != 127) { /* del */
++i;
continue;
blob - 18b733769b1ae829dc232a0a9e2258a91cec3b2b
blob + d97ef8a406db8176d013dc5e6b7e1618d1859a4e
--- parser_gemtext.c
+++ parser_gemtext.c
static int parse_pre_start(struct parser*, enum line_type, const char*, size_t);
static int parse_pre_cnt(struct parser*, enum line_type, const char*, size_t);
static int parse_pre_end(struct parser*, enum line_type, const char*, size_t);
+static int parse_linebreak(struct parser *, enum line_type, const char *, size_t);
static void search_title(struct parser*, enum line_type);
typedef int (parselinefn)(struct parser*, enum line_type, const char*, size_t);
[LINE_PRE_START] = parse_pre_start,
[LINE_PRE_CONTENT] = parse_pre_cnt,
[LINE_PRE_END] = parse_pre_end,
+ [LINE_BREAK] = parse_linebreak,
};
void
if (buf[0] == '`' && buf[1] == '`' && buf[2] == '`')
return LINE_PRE_START;
break;
+ case 0xC: /* form feed */
+ return LINE_BREAK;
}
return LINE_TEXT;
search_title(p, LINE_TITLE_3);
return 1;
+}
+
+static int
+parse_linebreak(struct parser *p, enum line_type t, const char *buf, size_t len)
+{
+ return emit_line(p, t, NULL, NULL);
}
static void
blob - ef98398b3626a915b01006ff3723470452943613
blob + c5c6b126335d09991a5ee82f85cd08cca4a2f029
--- telescope.h
+++ telescope.h
LINE_PRE_START,
LINE_PRE_CONTENT,
LINE_PRE_END,
+ LINE_BREAK,
/* text/x-patch */
LINE_PATCH,
blob - a622e686532715c9ae3e445390ff8fc7cdead884
blob + e075cab3a5e524546611f19eb261070470a9202f
--- ui.c
+++ ui.c
wprintw(window, "%s", vl->parent->alt);
}
+static inline void
+print_line_break(int width, WINDOW *window)
+{
+ int x, y;
+
+ getyx(window, y, x);
+ mvwprintw(window, y, width/2 - 4, "-*-*-");
+}
+
/*
* Core part of the rendering. It prints a vline starting from the
* current cursor position. Printing a vline consists of skipping
waddch(window, ' ');
wattr_off(window, body_face.left, NULL);
- wattr_on(window, f->prefix, NULL);
- wprintw(window, "%s", prfx);
- wattr_off(window, f->prefix, NULL);
+ if (vl->parent->type == LINE_BREAK) {
+ print_line_break(width, window);
+ } else {
+ wattr_on(window, f->prefix, NULL);
+ wprintw(window, "%s", prfx);
+ wattr_off(window, f->prefix, NULL);
+ }
wattr_on(window, f->text, NULL);
wprintw(window, "%s", text);
blob - 5b6289bc91bb36beeca2eb44c323fde71555bba1
blob + 48a4d5fc3422bb38f14bfe1cd87ff03085ff5182
--- ui.h
+++ ui.h
PPEND,
PPEND_PRFX,
PPEND_TRAIL,
+ PB,
+ PB_PRFX,
+ PB_TRAIL,
PPATCH,
PPATCH_PRFX,
blob - 6fd7a38bb0ef087bbca6a041f93fb5abbdefc022
blob + 56fea6a26b20d7263d471337f4138eb5a94f1bbf
--- wrap.c
+++ wrap.c
case LINE_PRE_END:
wrap_text(buffer, prfx, l, MIN(fill_column, width));
break;
+ case LINE_BREAK:
+ push_line(buffer, l, NULL, 0, 0);
+ break;
case LINE_PRE_CONTENT:
case LINE_PATCH:
case LINE_PATCH_HDR: