commit - 5b0108187c5b7b5466f2e8b5c7172e7b9aa3e44d
commit + 963c680c7051d662f760a610687bb45acdbb632e
blob - f771635b4b7f4874bd933a22b8def62f6558801c
blob + ba855645329bd01fe12bd6e919fb067429cabd90
--- ChangeLog
+++ ChangeLog
+2021-07-05 Omar Polo <op@omarpolo.com>
+
+ * cmd.c (cmd_push_button): push-button: toggle prefermatted blocks if invoked with the point on the header
+
2021-06-26 Omar Polo <op@omarpolo.com>
* cmd.c (cmd_inc_fill_column): add inc-fill-column and dec-fill-column
blob - 1394ab8c02d1eb924df52d129cbdd44d20a854bc
blob + 62a6b39eb871aaab770af1a265fc98c10f68512b
--- cmd.c
+++ cmd.c
if (buffer->current_line == NULL)
return 0;
+ vl = buffer->current_line;
did = 0;
while (n != 0) {
if (n > 0) {
- vl = TAILQ_NEXT(buffer->current_line, vlines);
+ vl = TAILQ_NEXT(vl, vlines);
if (vl == NULL)
return did;
+ if (vl->parent->flags & L_HIDDEN)
+ continue;
buffer->current_line = vl;
n--;
} else {
- vl = TAILQ_PREV(buffer->current_line, vhead, vlines);
+ vl = TAILQ_PREV(vl, vhead, vlines);
if (vl == NULL)
return did;
+ if (vl->parent->flags & L_HIDDEN)
+ continue;
if (buffer->current_line == buffer->top_line)
buffer->top_line = vl;
buffer->current_line = vl;
cmd_push_button(struct buffer *buffer)
{
struct vline *vl;
+ struct line *l;
vl = buffer->current_line;
- if (vl->parent->type != LINE_LINK)
- return;
-
- load_url_in_tab(current_tab(), vl->parent->alt);
+ switch (vl->parent->type) {
+ case LINE_LINK:
+ load_url_in_tab(current_tab(), vl->parent->alt);
+ break;
+ case LINE_PRE_START:
+ l = TAILQ_NEXT(vl->parent, lines);
+ for (; l != NULL; l = TAILQ_NEXT(l, lines)) {
+ if (l->type == LINE_PRE_END)
+ break;
+ l->flags ^= L_HIDDEN;
+ }
+ break;
+ default:
+ break;
+ }
}
void
blob - d0aa00a41fe1b7d1c3f698c0aa612c1497938598
blob + a0dbf4f90b84429cbab4831b9dcc486a410fdcaa
--- telescope.h
+++ telescope.h
LINE_PRE_CONTENT,
LINE_PRE_END,
};
+
+/* for lines: mark as hidden */
+#define L_HIDDEN 1
+
+/* for vlines: mark as continuation */
+#define L_CONTINUATION 2
struct line {
enum line_type type;
blob - 06a3922d220a391b8a27c9aae0e6dc6d3c015505
blob + ccedaa8e62420b77214b4475aff8f6ef22da0464
--- ui.c
+++ ui.c
l = 0;
onscreen = 0;
for (vl = buffer->top_line; vl != NULL; vl = TAILQ_NEXT(vl, vlines)) {
+ if (vl->parent->flags & L_HIDDEN)
+ continue;
+
wmove(win, l, 0);
print_vline(x_offset, width, win, vl);
for (; vl != NULL; vl = TAILQ_NEXT(vl, vlines)) {
if (vl == buffer->current_line)
break;
+ if (vl->parent->flags & L_HIDDEN)
+ continue;
buffer->line_off++;
buffer->top_line = TAILQ_NEXT(buffer->top_line, vlines);
}
blob - 74bf37b2eb0117d7607d19ce9df11484d5537817
blob + 491455e3491608b7d1d462e7d1e2c099df0944e7
--- wrap.c
+++ wrap.c
: utf8_next_cp((char*)lastsep);
if (!push_line(buffer, l, start, end - start, flags))
return 0;
- flags = 1;
+ flags = L_CONTINUATION;
start = end;
cur = prfxwidth + utf8_swidth_between(start, lastchar);
} else if (strchr(separators, *line) != NULL) {