aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog35
-rw-r--r--Makefile.am8
-rw-r--r--cmd.c8
-rw-r--r--cmd.h1
-rw-r--r--configure.ac8
-rw-r--r--contrib/dark.config5
-rw-r--r--contrib/light.config5
-rwxr-xr-xcontrib/xdg-migrate.sh2
-rw-r--r--defaults.c45
-rw-r--r--defaults.h6
-rw-r--r--downloads.c108
-rw-r--r--fs.c12
-rw-r--r--hist.c14
-rw-r--r--keymap.c21
-rw-r--r--keymap.h60
-rw-r--r--net.c6
-rw-r--r--pages/about_help.gmi2
-rw-r--r--parse.y79
-rw-r--r--parser.c2
-rw-r--r--parser_gemtext.c5
-rw-r--r--sandbox.c31
-rw-r--r--session.c9
-rw-r--r--site/Makefile19
-rw-r--r--site/gallery/contrib-brutalist.pngbin0 -> 29287 bytes
-rw-r--r--site/gallery/index.gmi18
-rw-r--r--site/gallery/index.html208
-rw-r--r--site/gallery/kitty-contrib-dark-about-help.pngbin0 -> 31783 bytes
-rw-r--r--site/gallery/kitty-contrib-dark-swiper.pngbin0 -> 58640 bytes
-rw-r--r--site/gallery/kitty-contrib-dark.pngbin0 -> 32519 bytes
-rw-r--r--site/gallery/kitty-default-look.pngbin0 -> 40131 bytes
-rw-r--r--site/gallery/thumb-contrib-brutalist.pngbin0 -> 55778 bytes
-rw-r--r--site/gallery/thumb-kitty-contrib-dark-about-help.pngbin0 -> 69528 bytes
-rw-r--r--site/gallery/thumb-kitty-contrib-dark-swiper.pngbin0 -> 107508 bytes
-rw-r--r--site/gallery/thumb-kitty-contrib-dark.pngbin0 -> 48025 bytes
-rw-r--r--site/gallery/thumb-kitty-default-look.pngbin0 -> 109057 bytes
-rw-r--r--site/gallery/thumb-xterm-contrib-light-about-help.pngbin0 -> 84577 bytes
-rw-r--r--site/gallery/thumb-xterm-contrib-light-swiper.pngbin0 -> 110173 bytes
-rw-r--r--site/gallery/thumb-xterm-contrib-light.pngbin0 -> 50682 bytes
-rw-r--r--site/gallery/thumb-xterm-default-look.pngbin0 -> 162509 bytes
-rw-r--r--site/gallery/xterm-contrib-light-about-help.pngbin0 -> 39211 bytes
-rw-r--r--site/gallery/xterm-contrib-light-swiper.pngbin0 -> 45901 bytes
-rw-r--r--site/gallery/xterm-contrib-light.pngbin0 -> 26588 bytes
-rw-r--r--site/gallery/xterm-default-look.pngbin0 -> 64386 bytes
-rw-r--r--site/index.gmi98
-rw-r--r--site/index.html286
-rwxr-xr-xsite/mdoc2html.sh30
-rw-r--r--site/telescope.1.html928
-rw-r--r--site/telescope.1.txt531
-rw-r--r--telescope.118
-rw-r--r--telescope.c134
-rw-r--r--telescope.h54
-rw-r--r--ui.c171
-rw-r--r--ui.h28
-rw-r--r--wrap.c3
54 files changed, 2776 insertions, 222 deletions
diff --git a/ChangeLog b/ChangeLog
index c8499e2..1f8dfa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2021-11-29 Omar Polo <op@omarpolo.com>
+
+ * configure.ac: tagged 0.6.1 bugfix release
+
+ * sandbox.c (open_landlock): handle gracefully when landlock is disabled at runtime. Reported and tested by Nikolay Korotkiy, thanks!
+
+ * configure.ac: tag 0.6 "Piccola storia ignobile"
+
+2021-11-27 Omar Polo <op@openbsd.org>
+
+ * telescope.1: mention that we're expecting an UTF-8 environment.
+
+2021-11-26 Omar Polo <op@omarpolo.com>
+
+ * configure.ac: add HOSTCC and HOSTFLAGS to aid cross-compiling since pagebundler needs to be built with the host compiler. Reported and tested by Nikolay Korotkiy, thanks!
+
+2021-11-24 Nikolay Korotkiy <sikmir@gmail.com>
+
+ * telescope.c (load_gemini_url): fix macOs crash on `__strlcpy_chk' due to wrong lengths
+
+2021-11-10 Omar Polo <op@omarpolo.com>
+
+ * net.c (net_error): handle empty replies (i.e. no header)
+
+2021-11-05 Omar Polo <op@omarpolo.com>
+
+ * defaults.c (load_default_keys): bind toggle-downloads to <f2>
+ (mappings): added download.{ongoing,done,info} and download style targets
+
+ * cmd.c (cmd_toggle_downloads): add toggle-downloads
+
+2021-10-26 Omar Polo <op@omarpolo.com>
+
+ * parser_gemtext.c (detect_line_type): correct item line detection: a space is required after the `*' character.
+
2021-10-08 Omar Polo <op@omarpolo.com>
* sandbox.c (landlock_unveil): use landlock on linux if available to restrict what parts of the filesystem telescope can see
diff --git a/Makefile.am b/Makefile.am
index b87d975..f280e31 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
bin_PROGRAMS = telescope
-EXTRA_telescope_SOURCES = compat/ohash.h compat/queue.h compat/imsg.h
+EXTRA_telescope_SOURCES = compat/ohash.h compat/queue.h compat/imsg.h contrib
telescope_SOURCES = cmd.c \
cmd.gen.c \
@@ -10,13 +10,16 @@ telescope_SOURCES = cmd.c \
compl.h \
defaults.c \
defaults.h \
+ downloads.c \
emoji-matcher.c \
fs.c \
+ fs.h \
gen-emoji-matcher.sh \
gencmd.awk \
help.c \
hist.c \
keymap.c \
+ keymap.h \
mime.c \
minibuffer.c \
minibuffer.h \
@@ -50,6 +53,9 @@ telescope_SOURCES += phos/phos.h \
noinst_PROGRAMS = pagebundler
pagebundler_SOURCES = pagebundler.c
+pagebundler$(EXEEXT): pagebundler.c
+ $(HOSTCC) $(HOSTCFLAGS) -o $@ $(srcdir)/pagebundler.c
+
BUILT_SOURCES = cmd.gen.c compile_flags.txt emoji-matcher.c pages.c
CLEANFILES = cmd.gen.c compile_flags.txt emoji-matcher.c pages.c \
diff --git a/cmd.c b/cmd.c
index af1433d..4308a59 100644
--- a/cmd.c
+++ b/cmd.c
@@ -588,7 +588,7 @@ cmd_list_bookmarks(struct buffer *buffer)
void
cmd_toggle_help(struct buffer *buffer)
{
- ui_toggle_side_window();
+ ui_toggle_side_window(SIDE_WINDOW_LEFT);
}
void
@@ -955,3 +955,9 @@ cmd_mini_scroll_down(struct buffer *buffer)
cmd_scroll_down(buffer);
buffer->current_line->parent->type = LINE_COMPL_CURRENT;
}
+
+void
+cmd_toggle_downloads(struct buffer *buffer)
+{
+ ui_toggle_side_window(SIDE_WINDOW_BOTTOM);
+}
diff --git a/cmd.h b/cmd.h
index 82bf0ee..d3e8e03 100644
--- a/cmd.h
+++ b/cmd.h
@@ -64,6 +64,7 @@ CMD(cmd_tab_next, "Focus next tab.");
CMD(cmd_tab_previous, "Focus previous tab.");
CMD(cmd_tab_select, "Switch to a tab using the minibuffer.");
CMD(cmd_toc, "Jump to a heading using the minibuffer.");
+CMD(cmd_toggle_downloads, "Toggle the downloads side window.");
CMD(cmd_toggle_help, "Toggle side window with help.");
CMD(cmd_toggle_pre_wrap, "Toggle the wrapping of preformatted blocks.");
diff --git a/configure.ac b/configure.ac
index 25c1073..1831dd1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([telescope], [0.5.1-dev], [telescope@omarpolo.com], [telescope], [gemini://telescope.omarpolo.com])
+AC_INIT([telescope], [0.6.1], [telescope@omarpolo.com], [telescope], [gemini://telescope.omarpolo.com])
AC_CONFIG_LIBOBJ_DIR(compat)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
@@ -8,6 +8,12 @@ AC_PROG_YACC
PKG_PROG_PKG_CONFIG
+AC_ARG_VAR(HOSTCC, [The C compiler on the host.])
+AC_ARG_VAR(HOSTCFLAGS, [CFLAGS for the host compiler])
+
+test -z "${HOSTCC}" && HOSTCC='$(CC)'
+test -z "${HOSTCFLAGS}" && HOSTCFLAGS='$(CFLAGS)'
+
AC_ARG_WITH([libimsg],
AS_HELP_STRING([--with-libimsg],
[Build with imsg-compat library (default: disabled)]))
diff --git a/contrib/dark.config b/contrib/dark.config
index 4ecd094..caf424f 100644
--- a/contrib/dark.config
+++ b/contrib/dark.config
@@ -50,3 +50,8 @@ style modeline {
bg color237
attr normal
}
+
+style line.download.ongoing bg color238
+style line.download.done bg color238
+style line.download.info bg color238
+style download bg color238
diff --git a/contrib/light.config b/contrib/light.config
index 49eace0..24c199d 100644
--- a/contrib/light.config
+++ b/contrib/light.config
@@ -24,3 +24,8 @@ style line.compl.current {
bg color50
attr normal
}
+
+style line.download.ongoing bg color254
+style line.download.done bg color254
+style line.download.info bg color254
+style download bg color254
diff --git a/contrib/xdg-migrate.sh b/contrib/xdg-migrate.sh
index 79a734d..d44e546 100755
--- a/contrib/xdg-migrate.sh
+++ b/contrib/xdg-migrate.sh
@@ -18,7 +18,7 @@ mkdir -p "$xdg_config" "$xdg_data" "$xdg_cache"
for filepath in \
"$xdg_config/config" \
- "$xdg_config/pages" \
+ "$xdg_data/pages" \
"$xdg_data/bookmarks.gmi" \
"$xdg_data/known_hosts"
do
diff --git a/defaults.c b/defaults.c
index bfe716e..fbeff6d 100644
--- a/defaults.c
+++ b/defaults.c
@@ -63,6 +63,10 @@ struct lineprefix line_prefixes[] = {
[LINE_COMPL_CURRENT] = {"", ""},
[LINE_HELP] = {"", ""},
+
+ [LINE_DOWNLOAD] = {" Fetching ", " "},
+ [LINE_DOWNLOAD_DONE] = {" Done ", " "},
+ [LINE_DOWNLOAD_INFO] = {" ", " "},
};
struct line_face line_faces[] = {
@@ -169,6 +173,23 @@ struct line_face line_faces[] = {
.pair = PHELP,
.trail_pair = PHELP_TRAIL,
},
+
+ /* download */
+ [LINE_DOWNLOAD] = {
+ .prfx_pair = PDOWNLOAD_PRFX,
+ .pair = PDOWNLOAD,
+ .trail_pair = PDOWNLOAD_TRAIL
+ },
+ [LINE_DOWNLOAD_DONE] = {
+ .prfx_pair = PDOWNLOAD_DONE_PRFX,
+ .pair = PDOWNLOAD_DONE,
+ .trail_pair = PDOWNLOAD_DONE_TRAIL
+ },
+ [LINE_DOWNLOAD_INFO] = {
+ .prfx_pair = PDOWNLOAD_INFO_PRFX,
+ .pair = PDOWNLOAD_INFO,
+ .trail_pair = PDOWNLOAD_INFO_TRAIL
+ },
};
struct tab_face tab_face = {
@@ -191,6 +212,12 @@ struct body_face body_face = {
.rbg = -1, .rfg = -1,
};
+struct download_face download_face = {
+ .bg = -1,
+ .fg = -1,
+ .attr = A_NORMAL,
+};
+
struct modeline_face modeline_face = {
.bg = -1,
.fg = -1,
@@ -231,6 +258,11 @@ struct mapping {
/* help */
{"help", LINE_HELP},
+
+ /* download */
+ {"download.ongoing", LINE_DOWNLOAD},
+ {"download.done", LINE_DOWNLOAD_DONE},
+ {"download.info", LINE_DOWNLOAD_INFO},
};
static struct mapping *
@@ -246,7 +278,6 @@ mapping_by_name(const char *name)
return NULL;
}
-
static inline void
global_set_key(const char *key, void (*fn)(struct buffer*))
{
@@ -380,6 +411,7 @@ load_default_keys(void)
/* global */
global_set_key("<f1>", cmd_toggle_help);
+ global_set_key("<f2>", cmd_toggle_downloads);
global_set_key("C-m", cmd_push_button);
global_set_key("M-enter", cmd_push_button_new_tab);
global_set_key("M-tab", cmd_previous_button);
@@ -594,6 +626,11 @@ config_setcolor(int bg, const char *name, int prfx, int line, int trail)
body_face.fg = line;
body_face.rfg = trail;
}
+ } else if (!strcmp(name, "download")) {
+ if (bg)
+ download_face.bg = prfx;
+ else
+ download_face.fg = prfx;
} else if (!strcmp(name, "minibuffer")) {
if (bg)
minibuffer_face.bg = prfx;
@@ -639,6 +676,8 @@ config_setattr(const char *name, int prfx, int line, int trail)
f->prfx_attr = prfx;
f->attr = line;
f->trail_attr = trail;
+ } else if (!strcmp(name, "download")) {
+ download_face.attr = prfx;
} else if (!strcmp(name, "minibuffer")) {
minibuffer_face.attr = prfx;
} else if (!strcmp(name, "modeline")) {
@@ -702,6 +741,10 @@ config_apply_style(void)
tl_init_pair(colors, PBRIGHT, body_face.rfg, body_face.rbg);
body_face.right = COLOR_PAIR(PBRIGHT);
+ /* download */
+ tl_init_pair(colors, PDOWNLOAD_WIN, download_face.fg, download_face.bg);
+ download_face.background = COLOR_PAIR(PDOWNLOAD_WIN) | download_face.attr;
+
/* modeline */
tl_init_pair(colors, PMODELINE, modeline_face.fg, modeline_face.bg);
modeline_face.background = COLOR_PAIR(PMODELINE) | modeline_face.attr;
diff --git a/defaults.h b/defaults.h
index 3cba520..d6f309f 100644
--- a/defaults.h
+++ b/defaults.h
@@ -66,6 +66,12 @@ struct body_face {
};
extern struct body_face body_face;
+struct download_face {
+ int bg, fg, attr;
+ int background;
+};
+extern struct download_face download_face;
+
struct modeline_face {
int bg, fg, attr;
int background;
diff --git a/downloads.c b/downloads.c
new file mode 100644
index 0000000..c245256
--- /dev/null
+++ b/downloads.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "compat.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "telescope.h"
+#include "ui.h"
+
+struct downloads downloads = STAILQ_HEAD_INITIALIZER(downloads);
+
+static void
+no_downloads(void)
+{
+ struct line *l;
+
+ if ((l = calloc(1, sizeof(*l))) == NULL)
+ abort();
+
+ l->type = LINE_DOWNLOAD_INFO;
+ l->line = strdup("No downloads");
+
+ TAILQ_INSERT_TAIL(&downloadwin.page.head, l, lines);
+}
+
+void
+recompute_downloads(void)
+{
+ struct download *d;
+ struct line *l;
+ char buf[FMT_SCALED_STRSIZE];
+
+ downloadwin.page.name = "*Downloads*";
+ erase_buffer(&downloadwin);
+
+ if (STAILQ_EMPTY(&downloads)) {
+ no_downloads();
+ goto end;
+ }
+
+ STAILQ_FOREACH(d, &downloads, entries) {
+ if ((l = calloc(1, sizeof(*l))) == NULL)
+ abort();
+
+ fmt_scaled(d->bytes, buf);
+
+ l->type = LINE_DOWNLOAD;
+ if (d->fd == -1)
+ l->type = LINE_DOWNLOAD_DONE;
+
+ l->line = strdup(buf);
+ l->alt = strdup(d->path);
+
+ TAILQ_INSERT_TAIL(&downloadwin.page.head, l, lines);
+ }
+
+end:
+ /*
+ * The exact value doesn't matter, as wrap_page only considers
+ * l->line, which is the human representation of the byte
+ * counter, and we know for sure is < FMT_SCALED_STRSIZE so it
+ * fits.
+ */
+ wrap_page(&downloadwin, download_cols);
+}
+
+void
+enqueue_download(uint32_t id, const char *path)
+{
+ struct download *d;
+
+ if ((d = calloc(1, sizeof(*d))) == NULL)
+ abort();
+
+ d->id = id;
+ d->fd = -1;
+ d->path = strdup(path);
+
+ STAILQ_INSERT_TAIL(&downloads, d, entries);
+}
+
+struct download *
+download_by_id(uint32_t id)
+{
+ struct download *d;
+
+ STAILQ_FOREACH(d, &downloads, entries) {
+ if (d->id == id)
+ return d;
+ }
+
+ return NULL;
+}
diff --git a/fs.c b/fs.c
index f1886e6..6352514 100644
--- a/fs.c
+++ b/fs.c
@@ -62,12 +62,18 @@ static void xdg_init(void);
static struct imsgev *iev_ui;
static FILE *session;
-/* WARNING: xdg_*_base variables are not initialized if ~/.telescope exists */
+/*
+ * Note: these are empty if ~/.telescope exists, use *_path_base
+ * below.
+ */
static char xdg_config_base[PATH_MAX];
static char xdg_data_base[PATH_MAX];
static char xdg_cache_base[PATH_MAX];
-/* *_path_base variables are all equal to $HOME/.telescope if it exists */
+/*
+ * Where to store user data. These are all equal to ~/.telescope if
+ * it exists.
+ */
char config_path_base[PATH_MAX];
char data_path_base[PATH_MAX];
char cache_path_base[PATH_MAX];
@@ -155,7 +161,7 @@ handle_get(struct imsg *imsg, size_t datalen)
if (page == NULL)
goto notfound;
- strlcpy(path, config_path_base, sizeof(path));
+ strlcpy(path, data_path_base, sizeof(path));
strlcat(path, "/", sizeof(path));
if (page->path != NULL)
strlcat(path, page->path, sizeof(path));
diff --git a/hist.c b/hist.c
index 4c4c762..93e92fb 100644
--- a/hist.c
+++ b/hist.c
@@ -36,3 +36,17 @@ hist_push(struct histhead *head, struct hist *h)
head->len++;
TAILQ_INSERT_TAIL(&head->head, h, entries);
}
+
+struct hist *
+hist_pop(struct histhead *head)
+{
+ struct hist *h, *p;
+
+ if ((h = TAILQ_LAST(&head->head, mhisthead)) == NULL)
+ return NULL;
+ if ((p = TAILQ_PREV(h, mhisthead, entries)) == NULL)
+ return NULL;
+
+ hist_clear_forward(head, h);
+ return p;
+}
diff --git a/keymap.c b/keymap.c
index 697a6d4..b52162b 100644
--- a/keymap.c
+++ b/keymap.c
@@ -20,6 +20,7 @@
#include <curses.h>
#include <stdlib.h>
+#include "keymap.h"
#include "telescope.h"
#define CTRL(n) ((n)&0x1F)
@@ -195,3 +196,23 @@ again:
return 1;
}
+int
+lookup_key(struct kmap **map, struct thiskey *key, struct buffer *buf)
+{
+ struct keymap *k;
+
+ TAILQ_FOREACH(k, &(*map)->m, keymaps) {
+ if (k->meta == key->meta &&
+ k->key == key->key) {
+ if (k->fn == NULL) {
+ *map = &k->map;
+ return LK_ADVANCED_MAP;
+ } else {
+ k->fn(buf);
+ return LK_MATCHED;
+ }
+ }
+ }
+
+ return LK_UNBOUND;
+}
diff --git a/keymap.h b/keymap.h
new file mode 100644
index 0000000..3b1ca4e
--- /dev/null
+++ b/keymap.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef KEYMAP_H
+#define KEYMAP_H
+
+#include "compat.h"
+
+#include <stdint.h>
+
+struct buffer;
+
+struct kmap {
+ TAILQ_HEAD(map, keymap) m;
+ void (*unhandled_input)(void);
+};
+extern struct kmap global_map, minibuffer_map;
+
+typedef void(interactivefn)(struct buffer *);
+
+struct keymap {
+ int meta;
+ int key;
+ struct kmap map;
+ interactivefn *fn;
+
+ TAILQ_ENTRY(keymap) keymaps;
+};
+
+struct thiskey {
+ short meta;
+ int key;
+ uint32_t cp;
+};
+
+enum {
+ LK_ADVANCED_MAP,
+ LK_MATCHED,
+ LK_UNBOUND,
+};
+
+int kbd(const char *);
+const char *unkbd(int);
+int kmap_define_key(struct kmap *, const char *, interactivefn *);
+int lookup_key(struct kmap **, struct thiskey *, struct buffer *);
+
+#endif
diff --git a/net.c b/net.c
index 6d8e0e4..4416c22 100644
--- a/net.c
+++ b/net.c
@@ -608,6 +608,12 @@ net_error(struct bufferevent *bev, short error, void *d)
}
if (error & EVBUFFER_EOF) {
+ /* EOF and no header */
+ if (!req->done_header) {
+ close_with_err(req, "protocol error");
+ return;
+ }
+
src = EVBUFFER_INPUT(req->bev);
if (EVBUFFER_LENGTH(src) != 0)
net_send_ui(IMSG_BUF, req->id, EVBUFFER_DATA(src),
diff --git a/pages/about_help.gmi b/pages/about_help.gmi
index b29b854..24c52e8 100644
--- a/pages/about_help.gmi
+++ b/pages/about_help.gmi
@@ -67,7 +67,7 @@ By default Telescope doesn’t use colours too much in order to adapt to both li
All the ‘about:*’ pages can be locally overridden. For example, to customise about:new create:
-> ~/.config/telescope/pages/about_new.gmi
+> ~/.local/share/telescope/pages/about_new.gmi
about:bookmarks is the only page that doesn’t follow this pattern; it’s located at
diff --git a/parse.y b/parse.y
index 7dbb9a9..e1f0b69 100644
--- a/parse.y
+++ b/parse.y
@@ -20,6 +20,7 @@
%{
+#include "keymap.h"
#include "telescope.h"
#include <phos/phos.h>
@@ -67,13 +68,17 @@ static void do_parseconfig(const char *, int);
%}
-%token TSET
-%token TSTYLE TPRFX TCONT TBG TFG TATTR
-%token TBIND TUNBIND
-%token TPROXY TVIA
+%token ATTR
+%token BIND BG
+%token CONT
+%token FG
+%token PRFX PROXY
+%token SET STYLE
+%token UNBIND
+%token VIA
-%token <str> TSTRING
-%token <num> TNUMBER
+%token <str> STRING
+%token <num> NUMBER
%%
@@ -93,41 +98,41 @@ rule : set
| proxy
;
-set : TSET TSTRING '=' TSTRING { setvars($2, $4); }
- | TSET TSTRING '=' TNUMBER { setvari($2, $4); }
+set : SET STRING '=' STRING { setvars($2, $4); }
+ | SET STRING '=' NUMBER { setvari($2, $4); }
;
-style : TSTYLE TSTRING { current_style = $2; } stylespec ;
+style : STYLE STRING { current_style = $2; } stylespec ;
stylespec : styleopt | '{' optnl styleopts '}' ;
styleopts : /* empty */
| styleopts styleopt optnl
;
-styleopt : TPRFX TSTRING { setprfx($2, $2); }
- | TPRFX TSTRING TSTRING { setprfx($2, $3); }
- | TBG { color_type = TBG; } colorspec
- | TFG { color_type = TFG; } colorspec
- | TATTR attr
+styleopt : PRFX STRING { setprfx($2, $2); }
+ | PRFX STRING STRING { setprfx($2, $3); }
+ | BG { color_type = BG; } colorspec
+ | FG { color_type = FG; } colorspec
+ | ATTR attr
;
-colorspec : TSTRING { setcolor($1, $1, $1); free($1); }
- | TSTRING TSTRING { setcolor($1, $2, $1); free($1); free($2); }
- | TSTRING TSTRING TSTRING { setcolor($1, $2, $3); free($1); free($2); free($3); }
+colorspec : STRING { setcolor($1, $1, $1); free($1); }
+ | STRING STRING { setcolor($1, $2, $1); free($1); free($2); }
+ | STRING STRING STRING { setcolor($1, $2, $3); free($1); free($2); free($3); }
;
-attr : TSTRING { setattr($1, $1, $1); free($1); }
- | TSTRING TSTRING { setattr($1, $2, $1); free($1); free($2); }
- | TSTRING TSTRING TSTRING { setattr($1, $2, $3); free($1); free($2); free($3); }
+attr : STRING { setattr($1, $1, $1); free($1); }
+ | STRING STRING { setattr($1, $2, $1); free($1); free($2); }
+ | STRING STRING STRING { setattr($1, $2, $3); free($1); free($2); free($3); }
;
-bind : TBIND TSTRING TSTRING TSTRING { bindkey($2, $3, $4); free($2); free($3); free($4); }
+bind : BIND STRING STRING STRING { bindkey($2, $3, $4); free($2); free($3); free($4); }
;
-unbind : TUNBIND TSTRING TSTRING { yyerror("TODO: unbind %s %s", $2, $3); }
+unbind : UNBIND STRING STRING { yyerror("TODO: unbind %s %s", $2, $3); }
;
-proxy : TPROXY TSTRING TVIA TSTRING { add_proxy($2, $4); free($4); }
+proxy : PROXY STRING VIA STRING { add_proxy($2, $4); free($4); }
;
optnl : '\n' optnl /* zero or more newlines */
@@ -153,17 +158,17 @@ static struct keyword {
const char *word;
int token;
} keywords[] = {
- { "attr", TATTR },
- { "bg", TBG },
- { "bind", TBIND },
- { "cont", TCONT },
- { "fg", TFG },
- { "prefix", TPRFX },
- { "proxy", TPROXY },
- { "set", TSET },
- { "style", TSTYLE },
- { "unbind", TUNBIND },
- { "via", TVIA },
+ { "attr", ATTR },
+ { "bg", BG },
+ { "bind", BIND },
+ { "cont", CONT },
+ { "fg", FG },
+ { "prefix", PRFX },
+ { "proxy", PROXY },
+ { "set", SET },
+ { "style", STYLE },
+ { "unbind", UNBIND },
+ { "via", VIA },
};
int
@@ -295,12 +300,12 @@ eow:
yylval.num = strtonum(buf, INT_MIN, INT_MAX, &errstr);
if (errstr != NULL)
yyerror("number is %s: %s", errstr, buf);
- return TNUMBER;
+ return NUMBER;
}
if ((str = strdup(buf)) == NULL)
err(1, "%s", __func__);
yylval.str = str;
- return TSTRING;
+ return STRING;
eof:
if (ferror(yyfp))
@@ -394,7 +399,7 @@ setcolor(const char *prfx, const char *line, const char *trail)
l = colorname(line);
t = colorname(trail);
- if (!config_setcolor(color_type == TBG, current_style, p, l, t))
+ if (!config_setcolor(color_type == BG, current_style, p, l, t))
yyerror("invalid style %s", current_style);
}
diff --git a/parser.c b/parser.c
index 3677a37..d86ecd1 100644
--- a/parser.c
+++ b/parser.c
@@ -29,7 +29,6 @@
int
load_page_from_str(struct tab *tab, const char *page)
{
- erase_buffer(&tab->buffer);
parser_init(tab, gemtext_initparser);
if (!tab->buffer.page.parse(&tab->buffer.page, page, strlen(page)))
abort();
@@ -43,6 +42,7 @@ load_page_from_str(struct tab *tab, const char *page)
void
parser_init(struct tab *tab, parserfn fn)
{
+ erase_buffer(&tab->buffer);
fn(&tab->buffer.page);
}
diff --git a/parser_gemtext.c b/parser_gemtext.c
index 18b7337..9c5b724 100644
--- a/parser_gemtext.c
+++ b/parser_gemtext.c
@@ -332,7 +332,10 @@ detect_line_type(const char *buf, size_t len, int in_pre)
return LINE_TEXT;
switch (*buf) {
- case '*': return LINE_ITEM;
+ case '*':
+ if (len > 1 && buf[1] == ' ')
+ return LINE_ITEM;
+ break;
case '>': return LINE_QUOTE;
case '=':
if (len >= 1 && buf[1] == '>')
diff --git a/sandbox.c b/sandbox.c
index 9c27dc0..b5adf78 100644
--- a/sandbox.c
+++ b/sandbox.c
@@ -120,6 +120,7 @@ landlock_restrict_self(int ruleset_fd, __u32 flags)
static int
open_landlock(void)
{
+ int fd;
struct landlock_ruleset_attr attr = {
.handled_access_fs = LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR |
@@ -128,7 +129,17 @@ open_landlock(void)
LANDLOCK_ACCESS_FS_MAKE_REG,
};
- return landlock_create_ruleset(&attr, sizeof(attr), 0);
+ fd = landlock_create_ruleset(&attr, sizeof(attr), 0);
+ if (fd == -1) {
+ switch (errno) {
+ case ENOSYS:
+ case EOPNOTSUPP:
+ return -1;
+ default:
+ err(1, "can't create landlock ruleset");
+ }
+ }
+ return fd;
}
static int
@@ -170,8 +181,12 @@ landlock_no_fs(void)
{
int fd;
+ /*
+ * XXX: landlock disabled at runtime, pretend everything's
+ * good.
+ */
if ((fd = open_landlock()) == -1)
- return -1;
+ return 0;
return landlock_apply(fd);
}
@@ -179,6 +194,10 @@ landlock_no_fs(void)
void
sandbox_net_process(void)
{
+ /*
+ * We don't know what paths are required for the TLS stack.
+ * Yes, it sucks.
+ */
return;
}
@@ -193,10 +212,14 @@ void
sandbox_fs_process(void)
{
int fd, rwc;
- char path[PATH_MAX];
+ char path[PATH_MAX];
+ /*
+ * XXX: at build-time we found landlock.h but we've just
+ * realized it's not available on this kernel, so do nothing.
+ */
if ((fd = open_landlock()) == -1)
- err(1, "can't create landlock ruleset");
+ return;
rwc = LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR |
diff --git a/session.c b/session.c
index c651b61..b703463 100644
--- a/session.c
+++ b/session.c
@@ -61,7 +61,6 @@ new_tab(const char *url, const char *base, struct tab *after)
event_loopbreak();
return NULL;
}
- tab->fd = -1;
TAILQ_INIT(&tab->hist.head);
@@ -105,14 +104,6 @@ void
stop_tab(struct tab *tab)
{
ui_send_net(IMSG_STOP, tab->id, NULL, 0);
-
- if (tab->fd != -1) {
- close(tab->fd);
- tab->fd = -1;
- free(tab->path);
- tab->path = NULL;
- load_page_from_str(tab, "Stopped.\n");
- }
}
void
diff --git a/site/Makefile b/site/Makefile
new file mode 100644
index 0000000..dd159a6
--- /dev/null
+++ b/site/Makefile
@@ -0,0 +1,19 @@
+.PHONY: all serve-www serve-gemini upload
+
+all: telescope.1.html telescope.1.txt
+
+telescope.1.html: ../telescope.1
+ ./mdoc2html.sh $? $@
+
+telescope.1.txt: ../telescope.1
+ MANWIDTH=72 man -Tutf8 -l $? | col -b > $@
+
+serve-www:
+ python3 -m http.server 8888
+
+serve-gemini:
+ gmid -p 1966 .
+
+upload:
+ rsync --delete -a . op:sites/telescope.omarpolo.com
+ rsync --delete -a . op:gemini/telescope.omarpolo.com
diff --git a/site/gallery/contrib-brutalist.png b/site/gallery/contrib-brutalist.png
new file mode 100644
index 0000000..89fb8ab
--- /dev/null
+++ b/site/gallery/contrib-brutalist.png
Binary files differ
diff --git a/site/gallery/index.gmi b/site/gallery/index.gmi
new file mode 100644
index 0000000..41ccc45
--- /dev/null
+++ b/site/gallery/index.gmi
@@ -0,0 +1,18 @@
+=> / Home
+=> /telescope.1.txt Docs
+
+# Gallery
+
+=> xterm-default-look.png default look on bright terminal
+=> kitty-default-look.png default look on dark terminal
+
+=> xterm-contrib-light.png the contrib/light theme
+=> kitty-contrib-dark.png the contrib/dark theme
+
+=> xterm-contrib-light-swiper.png swiper with the contrib/light theme
+=> kitty-contrib-dark-swiper.png swiper with the contrib/dark theme
+
+=> xterm-contrib-light-about-help.png about:help with the contrib/light theme
+=> kitty-contrib-dark-about-help.png about:help with the contrib/dark theme
+
+=> contrib-brutalist.png Brutalist theme
diff --git a/site/gallery/index.html b/site/gallery/index.html
new file mode 100644
index 0000000..71690c8
--- /dev/null
+++ b/site/gallery/index.html
@@ -0,0 +1,208 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Gallery | Telescope</title>
+ <meta charset="utf8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <style>
+ body {
+ font-family: monospace;
+ font-size: 14px;
+ max-width: 780px;
+ margin: 0 auto;
+ padding: 20px;
+ padding-bottom: 80px;
+ }
+
+ h1::before {
+ content: "# ";
+ }
+
+ h2 {
+ margin-top: 40px;
+ }
+
+ h2::before {
+ content: "## ";
+ }
+
+ h3::before {
+ content: "### ";
+ }
+
+ blockquote {
+ margin: 0;
+ padding: 0;
+ }
+
+ blockquote::before {
+ content: "> ";
+ }
+
+ blockquote p {
+ font-style: italic;
+ display: inline;
+ }
+
+ p.link::before {
+ content: "→ ";
+ }
+
+ hr {
+ border: 0;
+ height: 1px;
+ background-color: #222;
+ width: 100%;
+ display: block;
+ margin: 2em auto;
+ }
+
+ pre {
+ overflow: auto;
+ }
+
+ pre.banner {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ }
+
+ code, kbd {
+ color: #9d109d;
+ }
+
+ img {
+ display: block;
+ margin: 0 auto;
+ max-width: 100%;
+ }
+
+ figcaption {
+ margin: 0;
+ padding: 10px 0;
+ text-align: center;
+ }
+
+ main {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: space-around;
+ }
+
+ figure {
+ width: 40%;
+ margin: 1rem;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background-color: #222;
+ color: white;
+ }
+
+ img {
+ filter: brightness(0.65);
+ transition: filter 0.2s ease-in-out;
+ }
+
+ img:hover {
+ filter: brightness(1.0);
+ }
+
+ a {
+ color: aqua;
+ }
+
+ hr {
+ background-color: #ddd;
+ }
+
+ code, kbd {
+ color: #ff4cff;
+ }
+ }
+
+ @media (max-width: 400px) {
+ pre.banner { font-size: 9px; }
+ }
+
+ @media (max-width: 500px) {
+ pre.banner { font-size: 10px; }
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <nav>
+ <a href="/">Home</a> | Gallery | <a href="/telescope.1.html">Docs</a>
+ </nav>
+ </header>
+ <main>
+
+ <figure>
+ <a href="xterm-default-look.png">
+ <img src="thumb-xterm-default-look.png" alt="xterm-default-look.png" />
+ </a>
+ <figcaption>default look on bright terminal</figcaption>
+ </figure>
+
+ <figure>
+ <a href="kitty-default-look.png">
+ <img src="thumb-kitty-default-look.png" alt="kitty-default-look.png" />
+ </a>
+ <figcaption>default look on dark terminal</figcaption>
+ </figure>
+
+ <figure>
+ <a href="xterm-contrib-light.png">
+ <img src="thumb-xterm-contrib-light.png" alt="xterm-contrib-light.png" />
+ </a>
+ <figcaption>the contrib/light theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="kitty-contrib-dark.png">
+ <img src="thumb-kitty-contrib-dark.png" alt="kitty-contrib-dark.png" />
+ </a>
+ <figcaption>the contrib/dark theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="xterm-contrib-light-swiper.png">
+ <img src="thumb-xterm-contrib-light-swiper.png" alt="xterm-contrib-light-swiper.png" />
+ </a>
+ <figcaption>swiper with the contrib/light theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="kitty-contrib-dark-swiper.png">
+ <img src="thumb-kitty-contrib-dark-swiper.png" alt="kitty-contrib-dark-swiper.png" />
+ </a>
+ <figcaption>swiper with the contrib/dark theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="xterm-contrib-light-about-help.png">
+ <img src="thumb-xterm-contrib-light-about-help.png" alt="xterm-contrib-light-about-help.png" />
+ </a>
+ <figcaption>about:help with the contrib/light theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="kitty-contrib-dark-about-help.png">
+ <img src="thumb-kitty-contrib-dark-about-help.png" alt="kitty-contrib-dark-about-help.png" />
+ </a>
+ <figcaption>about:help with the contrib/dark theme</figcaption>
+ </figure>
+
+ <figure>
+ <a href="contrib-brutalist.png">
+ <img src="thumb-contrib-brutalist.png" alt="contrib-brutalist.png" />
+ </a>
+ <figcaption>Brutalist theme</figcaption>
+ </figure>
+
+ </main>
+ </body>
+</html>
diff --git a/site/gallery/kitty-contrib-dark-about-help.png b/site/gallery/kitty-contrib-dark-about-help.png
new file mode 100644
index 0000000..1549b03
--- /dev/null
+++ b/site/gallery/kitty-contrib-dark-about-help.png
Binary files differ
diff --git a/site/gallery/kitty-contrib-dark-swiper.png b/site/gallery/kitty-contrib-dark-swiper.png
new file mode 100644
index 0000000..a44d14b
--- /dev/null
+++ b/site/gallery/kitty-contrib-dark-swiper.png
Binary files differ
diff --git a/site/gallery/kitty-contrib-dark.png b/site/gallery/kitty-contrib-dark.png
new file mode 100644
index 0000000..4e1cb10
--- /dev/null
+++ b/site/gallery/kitty-contrib-dark.png
Binary files differ
diff --git a/site/gallery/kitty-default-look.png b/site/gallery/kitty-default-look.png
new file mode 100644
index 0000000..e595804
--- /dev/null
+++ b/site/gallery/kitty-default-look.png
Binary files differ
diff --git a/site/gallery/thumb-contrib-brutalist.png b/site/gallery/thumb-contrib-brutalist.png
new file mode 100644
index 0000000..c63bf46
--- /dev/null
+++ b/site/gallery/thumb-contrib-brutalist.png
Binary files differ
diff --git a/site/gallery/thumb-kitty-contrib-dark-about-help.png b/site/gallery/thumb-kitty-contrib-dark-about-help.png
new file mode 100644
index 0000000..74f8053
--- /dev/null
+++ b/site/gallery/thumb-kitty-contrib-dark-about-help.png
Binary files differ
diff --git a/site/gallery/thumb-kitty-contrib-dark-swiper.png b/site/gallery/thumb-kitty-contrib-dark-swiper.png
new file mode 100644
index 0000000..f556f8b
--- /dev/null
+++ b/site/gallery/thumb-kitty-contrib-dark-swiper.png
Binary files differ
diff --git a/site/gallery/thumb-kitty-contrib-dark.png b/site/gallery/thumb-kitty-contrib-dark.png
new file mode 100644
index 0000000..89bac11
--- /dev/null
+++ b/site/gallery/thumb-kitty-contrib-dark.png
Binary files differ
diff --git a/site/gallery/thumb-kitty-default-look.png b/site/gallery/thumb-kitty-default-look.png
new file mode 100644
index 0000000..0028874
--- /dev/null
+++ b/site/gallery/thumb-kitty-default-look.png
Binary files differ
diff --git a/site/gallery/thumb-xterm-contrib-light-about-help.png b/site/gallery/thumb-xterm-contrib-light-about-help.png
new file mode 100644
index 0000000..ccbaa33
--- /dev/null
+++ b/site/gallery/thumb-xterm-contrib-light-about-help.png
Binary files differ
diff --git a/site/gallery/thumb-xterm-contrib-light-swiper.png b/site/gallery/thumb-xterm-contrib-light-swiper.png
new file mode 100644
index 0000000..19fe6e1
--- /dev/null
+++ b/site/gallery/thumb-xterm-contrib-light-swiper.png
Binary files differ
diff --git a/site/gallery/thumb-xterm-contrib-light.png b/site/gallery/thumb-xterm-contrib-light.png
new file mode 100644
index 0000000..128c2cf
--- /dev/null
+++ b/site/gallery/thumb-xterm-contrib-light.png
Binary files differ
diff --git a/site/gallery/thumb-xterm-default-look.png b/site/gallery/thumb-xterm-default-look.png
new file mode 100644
index 0000000..bb07a03
--- /dev/null
+++ b/site/gallery/thumb-xterm-default-look.png
Binary files differ
diff --git a/site/gallery/xterm-contrib-light-about-help.png b/site/gallery/xterm-contrib-light-about-help.png
new file mode 100644
index 0000000..e20c6a4
--- /dev/null
+++ b/site/gallery/xterm-contrib-light-about-help.png
Binary files differ
diff --git a/site/gallery/xterm-contrib-light-swiper.png b/site/gallery/xterm-contrib-light-swiper.png
new file mode 100644
index 0000000..0085be3
--- /dev/null
+++ b/site/gallery/xterm-contrib-light-swiper.png
Binary files differ
diff --git a/site/gallery/xterm-contrib-light.png b/site/gallery/xterm-contrib-light.png
new file mode 100644
index 0000000..4e4f074
--- /dev/null
+++ b/site/gallery/xterm-contrib-light.png
Binary files differ
diff --git a/site/gallery/xterm-default-look.png b/site/gallery/xterm-default-look.png
new file mode 100644
index 0000000..01bb23f
--- /dev/null
+++ b/site/gallery/xterm-default-look.png
Binary files differ
diff --git a/site/index.gmi b/site/index.gmi
new file mode 100644
index 0000000..8d5def6
--- /dev/null
+++ b/site/index.gmi
@@ -0,0 +1,98 @@
+=> /gallery/ Gallery
+=> /telescope.1.txt Docs
+
+# Telescope
+
+> Telescope is a w3m-like browser for Gemini.
+
+``` Ascii art of the word “Telescope” and “v0.6.1”
+ _______ __
+|_ _|.-----.| |.-----.-----.----.-----.-----.-----.
+ | | | -__|| || -__|__ --| __| _ | _ | -__|
+ |___| |_____||__||_____|_____|____|_____| __|_____|
+ |__| v0.6.1
+```
+
+Telescope is written entirely for fun, as a hobbystic project in my free time. As such, it lacks a ton of features you’ll find in more mature Gemini browsers, but it also has some unique ones.
+
+The UI is strongly inspired from Emacs and W3M, so you’ll find some familiar concepts, such as the minibuffer or the tabline, and the default keybindigs also reflect this, but care has been taken to add keys familiar for vi and CUA users too.
+
+=> https://asciinema.org/a/426862 Asciinema record
+
+## Install
+
+=> https://repology.org/project/telescope/versions Some distros provide a package — thanks to the maintainers!
+
+Source code is available:
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.1.tar.gz telescope-0.6.1.tar.gz
+
+The dependencies are:
+* libncurses
+* libevent
+* libtls (from either LibreSSL or libretls)
+* yacc (or GNU bison)
+
+Once all the dependencies are installed, building is as easy as:
+
+```Example of how to compile from source
+$ curl -LO https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.1.tar.gz
+$ tar xzvf telescope-0.6.1.tar.gz
+$ cd telescope-0.6.1
+$ ./configure
+$ make
+$ sudo make install # eventually
+```
+
+A SHA256 file containing the checksums is available. However, that only checks for accidental corruption: you can use signify (SHA256.sig and the public key telescope-0.6.pub) or GPG. The hash of the signify public key is also included in the SHA256 file and signed with my GPG too. The signify public key for the next release ‘telescope-0.7.pub’ is also included.
+
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256 SHA256
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256.gpg SHA256.gpg
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256.sig SHA256.sig
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.pub telescope-0.6.pub
+=> https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.7.pub telescope-0.7.pub
+
+```Example of how to verify the signature with signify
+$ signify -C -p telescope-0.6.pub -x SHA256.sig
+Signature Verified
+telescope-0.6.pub: OK
+telescope-0.6.1.tar.gz: OK
+telescope-0.7.pub: OK
+telescope.linux.aarch64: OK
+telescope.linux.amd64: OK
+```
+
+Finally, it’s possible to fetch the sources using git:
+
+=> //git.omarpolo.com/telescope/ git repository
+=> https://github.com/omar-polo/telescope GitHub mirror
+
+
+## Changelog
+
+0.6.1 “Piccola storia ignobile” bugfix release — Released November 29, 2021
+
+* Handle gracefully when landlock is disabled at runtime. Reported and tested by Nikolay Korotkiy, thanks!
+
+
+0.6 “Piccola storia ignobile” — Released November 29, 2021
+
+## New features
+
+* added a pane that lists all the downloads (current or not)
+* download-path is customizable
+* sandbox/safe mode: telescope won't write anything to the file system.
+* XDG-style directories if ~/.telescope does not exists; idea and implementation by Andrea Feletto, thanks! (there's a script also by him in contrib to migrate the setup)
+
+## Improvements
+
+* prefill the save prompt with the file name
+* use landlock on linux if available
+* add HOSTCC and HOSTCFLAGS variables for the configure script to allow cross-compiling (‘pagebundler’ needs to be built with the host compiler no matter what.) Prompted and tested by Nikolay Korotkiy, thanks!
+
+## Bug fixes
+
+* fix diff syntax highlighting with more than one header involved
+* [gemini] fix item line detection: a space is required after the `*' character
+* handle empty replies (i.e. no header.) Found thanks to ondollo' capsule :)
+* fixed a crash on macOs, by Nikolay Korotkiy (sikmir on github). Thanks!
+* mention that telescope expects an UTF-8 environment in the CAVEATS section of the manpage
diff --git a/site/index.html b/site/index.html
new file mode 100644
index 0000000..0ace65c
--- /dev/null
+++ b/site/index.html
@@ -0,0 +1,286 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <title>Telescope</title>
+ <meta charset="utf8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <style>
+ body {
+ font-family: monospace;
+ font-size: 14px;
+ max-width: 780px;
+ margin: 0 auto;
+ padding: 20px;
+ padding-bottom: 80px;
+ }
+
+ h1::before {
+ content: "# ";
+ }
+
+ h2 {
+ margin-top: 40px;
+ }
+
+ h2::before {
+ content: "## ";
+ }
+
+ h3::before {
+ content: "### ";
+ }
+
+ blockquote {
+ margin: 0;
+ padding: 0;
+ }
+
+ blockquote::before {
+ content: "> ";
+ }
+
+ blockquote p {
+ font-style: italic;
+ display: inline;
+ }
+
+ p.link::before {
+ content: "→ ";
+ }
+
+ hr {
+ border: 0;
+ height: 1px;
+ background-color: #222;
+ width: 100%;
+ display: block;
+ margin: 2em auto;
+ }
+
+ pre {
+ overflow: auto;
+ }
+
+ pre.banner {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ }
+
+ code, kbd {
+ color: #9d109d;
+ }
+
+ img {
+ display: block;
+ margin: 0 auto;
+ max-width: 100%;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background-color: #222;
+ color: white;
+ }
+
+ img {
+ filter: brightness(0.65);
+ transition: filter 0.2s ease-in-out;
+ }
+
+ img:hover {
+ filter: brightness(1.0);
+ }
+
+ a {
+ color: aqua;
+ }
+
+ hr {
+ background-color: #ddd;
+ }
+
+ code, kbd {
+ color: #ff4cff;
+ }
+ }
+
+ @media (max-width: 400px) {
+ pre.banner { font-size: 9px; }
+ }
+
+ @media (max-width: 500px) {
+ pre.banner { font-size: 10px; }
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <nav>
+ Home | <a href="/gallery/">Gallery</a> | <a href="telescope.1.html">Docs</a>
+ </nav>
+ </header>
+ <pre class="banner"> _______ __
+|_ _|.-----.| |.-----.-----.----.-----.-----.-----.
+ | | | -__|| || -__|__ --| __| _ | _ | -__|
+ |___| |_____||__||_____|_____|____|_____| __|_____|
+ |__| v0.6.1</pre>
+ <blockquote>
+ <p>Telescope is a w3m-like browser for Gemini</p>
+ </blockquote>
+ <p>
+ Telescope is written entirely for fun, as a hobbystic project in
+ my free time. As such, it lacks a ton of features you’ll find
+ in more mature Gemini browsers, but it also has some unique
+ ones.
+ </p>
+ <p>
+ The UI is strongly inspired from Emacs and W3M, so you’ll find
+ some familiar concepts, such as the minibuffer or the tabline,
+ and the default keybindigs also reflect this, but keys familiar
+ for vi and CUA users are also present by default.
+ </p>
+ <p>
+ <a href="https://asciinema.org/a/426862" target="_blank">
+ <img src="https://asciinema.org/a/426862.svg" />
+ </a>
+ </p>
+ <h2>Install</h2>
+ <p>Some distros provide a package — thanks to the maintainers!</p>
+ <a href="https://repology.org/project/telescope/versions">
+ <img src="https://repology.org/badge/vertical-allrepos/telescope.svg" alt="Packaging status">
+ </a>
+ <p>Source code is available:</p>
+ <ul>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.1.tar.gz">
+ telescope-0.6.1.tar.gz
+ </a>
+ </li>
+ </ul>
+ <p>The dependencies are:</p>
+ <ul>
+ <li>libncurses</li>
+ <li>libevent</li>
+ <li>libtls (from either LibreSSL or libretls)</li>
+ <li>yacc (or GNU bison)</li>
+ </ul>
+ <p>Once all the dependencies are installed, building is as easy as:</p>
+ <pre>$ curl -LO https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.1.tar.gz
+$ tar xzvf telescope-0.6.1.tar.gz
+$ cd telescope-0.6.1
+$ ./configure
+$ make
+$ sudo make install # eventually
+ </pre>
+ <p>
+ A SHA256 file containing the checksums is available. However,
+ that only checks for accidental corruption: you can use signify
+ (<code>SHA256.sig</code> and the public key
+ <code>telescope-0.6.pub</code>) or GPG. The hash of the signify
+ public key is also included in the SHA256 file and signed with
+ my GPG too. The signify public key for the next release
+ <code>telescope-0.7.pub</code> is also included.
+ </p>
+ <ul>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256">
+ SHA256
+ </a>
+ </li>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256.gpg">
+ SHA256.gpg
+ </a>
+ </li>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/SHA256.sig">
+ SHA256.sig
+ </a>
+ </li>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.6.pub">
+ telescope-0.6.pub
+ </a>
+ </li>
+ <li>
+ <a href="https://github.com/omar-polo/telescope/releases/download/0.6.1/telescope-0.7.pub">
+ telescope-0.7.pub
+ </a>
+ </li>
+ </ul>
+ <p>How to verify the signature with signify:</p>
+ <pre>$ signify -C -p telescope-0.6.pub -x SHA256.sig
+Signature Verified
+telescope-0.6.pub: OK
+telescope-0.6.1.tar.gz: OK
+telescope-0.7.pub: OK
+telescope.linux.aarch64: OK
+telescope.linux.amd64: OK
+ </pre>
+ <p>Finally, it’s possible to fetch the sources using git:</p>
+ <ul>
+ <li>
+ <a href="https://git.omarpolo.com/telescope/">git repository</a>
+ </li>
+ <li>
+ <a href="https://github.com/omar-polo/telescope">GitHub mirror</a>
+ </li>
+ </ul>
+ <h2>Changelog</h2>
+ <p>0.6.1 “Piccola storia ignobile” bugfix release — Released November 29, 2021</p>
+ <ul>
+ <li>
+ Handle gracefully when landlock is disabled at runtime.
+ Reported and tested by Nikolay Korotkiy, thanks!
+ </li>
+ </ul>
+ <hr />
+ <p>0.6 “Piccola storia ignobile” — Released November 29, 2021</p>
+ <h3>New features</h3>
+ <ul>
+ <li>added a pane that lists all the downloads (current or not)</li>
+ <li>download-path is customizable</li>
+ <li>
+ sandbox/safe mode: telescope won't write anything to the file
+ system.
+ </li>
+ <li>
+ XDG-style directories if ~/.telescope does not exists; idea
+ and implementation by Andrea Feletto, thanks! (there's a
+ script also by him in contrib to migrate the setup)
+ </li>
+ </ul>
+ <h3>Improvements</h3>
+ <ul>
+ <li>prefill the save prompt with the file name</li>
+ <li>use landlock on linux if available</li>
+ <li>
+ add <code>HOSTCC</code> and <code>HOSTCFLAGS</code> variables
+ for the configure script to allow cross-compiling (<code>pagebundler</code>
+ needs to be built with the host compiler no matter what.)
+ Prompted and tested by Nikolay Korotkiy, thanks!
+ </li>
+ </ul>
+ <h3>Bug fixes</h3>
+ <ul>
+ <li>fix diff syntax highlighting with more than one header involved</li>
+ <li>
+ [gemini] fix item line detection: a space is required after
+ the <code>*</code> character
+ </li>
+ <li>
+ handle empty replies (i.e. no header.) Found thanks to
+ ondollo' capsule :)
+ </li>
+ <li>
+ fixed a crash on macOs, by Nikolay Korotkiy (sikmir on
+ github). Thanks!
+ </li>
+ <li>
+ mention that telescope expects an UTF-8 environment in the
+ CAVEATS section of the manpage
+ </li>
+ </ul>
+ </body>
+</html>
diff --git a/site/mdoc2html.sh b/site/mdoc2html.sh
new file mode 100755
index 0000000..4cb718f
--- /dev/null
+++ b/site/mdoc2html.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# usage: mdoc2html.sh src out
+#
+# converts the manpage `src' to the HTML file `out', tweaking the
+# style
+
+set -e
+
+: ${1:?missing input file}
+: ${2:?missing output file}
+
+man -Thtml -l "$1" > "$2"
+
+exec ed "$2" <<EOF
+/<style>
+a
+ body {
+ max-width: 960px;
+ margin: 0 auto;
+ padding: 0 10px;
+ font-size: 1rem;
+ }
+
+ pre {
+ overflow: auto;
+ }
+.
+wq
+EOF
diff --git a/site/telescope.1.html b/site/telescope.1.html
new file mode 100644
index 0000000..cae9a49
--- /dev/null
+++ b/site/telescope.1.html
@@ -0,0 +1,928 @@
+<!DOCTYPE html>
+<html>
+<!-- This is an automatically generated file. Do not edit.
+ Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ -->
+<head>
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <style>
+ body {
+ max-width: 960px;
+ margin: 0 auto;
+ padding: 0 1rem;
+ font-family: monospace;
+ font-size: 1rem;
+ }
+ table.head, table.foot { width: 100%; }
+ td.head-rtitle, td.foot-os { text-align: right; }
+ td.head-vol { text-align: center; }
+ .Nd, .Bf, .Op { display: inline; }
+ .Pa, .Ad { font-style: italic; }
+ .Ms { font-weight: bold; }
+ .Bl-diag > dt { font-weight: bold; }
+ code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd { font-weight: bold;
+ font-family: inherit; }
+ </style>
+ <title>TELESCOPE(1)</title>
+</head>
+<body>
+<table class="head">
+ <tr>
+ <td class="head-ltitle">TELESCOPE(1)</td>
+ <td class="head-vol">General Commands Manual</td>
+ <td class="head-rtitle">TELESCOPE(1)</td>
+ </tr>
+</table>
+<div class="manual-text">
+<section class="Sh">
+<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
+<p class="Pp"><code class="Nm">telescope</code> &#x2014;
+ <span class="Nd">multi-protocol browser</span></p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
+<table class="Nm">
+ <tr>
+ <td><code class="Nm">telescope</code></td>
+ <td>[<code class="Fl">-Chnv</code>]
+ [<code class="Fl">-c</code>&#x00A0;<span class="Pa">config</span>]
+ [<var class="Ar">URL</var>]</td>
+ </tr>
+</table>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
+<p class="Pp"><code class="Nm">telescope</code> is an interactive browser that
+ supports the Finger, Gemini and Gopher protocols.
+ <code class="Nm">telescope</code> features tabs, a minibuffer, interactive
+ completions, bookmarks and out-of-band TOFU verification.</p>
+<p class="Pp">The arguments are as follows:</p>
+<dl class="Bl-tag">
+ <dt id="C"><a class="permalink" href="#C"><code class="Fl">-C</code></a>,
+ <code class="Fl">--colors</code></dt>
+ <dd>Show all available colors and exit.</dd>
+ <dt id="c"><a class="permalink" href="#c"><code class="Fl">-c</code></a>
+ <span class="Pa">config</span></dt>
+ <dd>Specify an alternative configuration file. By default
+ <span class="Pa">$HOME/.telescope/config</span> is loaded.</dd>
+ <dt id="h"><a class="permalink" href="#h"><code class="Fl">-h</code></a>,
+ <code class="Fl">--help</code></dt>
+ <dd>Display version and usage.</dd>
+ <dt id="n"><a class="permalink" href="#n"><code class="Fl">-n</code></a></dt>
+ <dd>Configtest mode. Only check the configuration file for validity.</dd>
+ <dt id="v"><a class="permalink" href="#v"><code class="Fl">-v</code></a>,
+ <code class="Fl">--version</code></dt>
+ <dd>Display version.</dd>
+</dl>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="UI_CONCEPTS"><a class="permalink" href="#UI_CONCEPTS">UI
+ CONCEPTS</a></h1>
+<p class="Pp"><code class="Nm">telescope</code> interface is divided into four
+ areas: the tabline, the body, the modeline and the echoarea/minibuffer.</p>
+<p class="Pp">The tabline is always at the top of the screen and displays the
+ tabs separated by a vertical line. When there are more tabs than the size of
+ the window allow to display, the characters &#x2018;&lt;&#x2019; or
+ &#x2018;&gt;&#x2019; are shown at the start/end of the tabline to indicate
+ that there are more tabs in that direction.</p>
+<p class="Pp">The body occupies the majority of the visible area. It contains
+ the current page and optionally a side window.</p>
+<p class="Pp">The modeline is the second to last row of the screen. It shows
+ some information about the page: a spinner when the page is loading, the
+ trust level, the document type, the scroll offset and the URL.</p>
+<p class="Pp">The echoarea is usually the last line of the screen. Messages are
+ often showed there, and link addresses too. The echoarea is also used to
+ obtain input from the user. When commands like
+ <code class="Ic">swiper</code> or <code class="Ic">link-select</code> are
+ invoked, the minibuffer area grows to show possible completions.</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="TOFU"><a class="permalink" href="#TOFU">TOFU</a></h1>
+<p class="Pp"><code class="Nm">telescope</code> aims to use the &#x201C;Trust,
+ but Verify (where appropriate)&#x201D; approach for TOFU (&#x201C;Trust On
+ First Use&#x201D;). The idea is to define three level of verification for a
+ certificate:</p>
+<dl class="Bl-tag">
+ <dt>untrusted</dt>
+ <dd>(&#x2018;!&#x2019;) the server fingerprint does NOT match the stored
+ value.</dd>
+ <dt>trusted</dt>
+ <dd>(&#x2018;v&#x2019;) the server fingerprint matches the store one.</dd>
+ <dt>verified</dt>
+ <dd>(&#x2018;V&#x2019;) the fingerprint matches and has been verified
+ out-of-band.</dd>
+</dl>
+<p class="Pp">The trust level of the page is indicated in the modeline with the
+ indicated character.</p>
+<p class="Pp">Most of the time the &#x201C;trusted&#x201D; level is enough, but
+ where is appropriate users should be able to verify out-of-band the
+ certificate.</p>
+<p class="Pp">At the moment, there is no built-in support for an out-of-band
+ verification though.</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="SUPPORTED_PROTOCOLS"><a class="permalink" href="#SUPPORTED_PROTOCOLS">SUPPORTED
+ PROTOCOLS</a></h1>
+<p class="Pp">The following protocols are supported:</p>
+<dl class="Bl-tag">
+ <dt>about:</dt>
+ <dd>About pages are <code class="Nm">telescope</code> internal page. See
+ about:about for a list of all these pages.</dd>
+ <dt>file://</dt>
+ <dd>File types know to <code class="Nm">telescope</code>, such as .gmi,
+ .gemini, .txt, .md, .markdown, .diff or .patch, can be viewed inside the
+ application. Types of local files are detected solely based on the file
+ extension. On some systems, such as <span class="Ux">OpenBSD</span>, only
+ files inside special directories (like <span class="Pa">/tmp</span>
+ <span class="No">or</span> <span class="Pa">~/Downloads</span>) are
+ available.</dd>
+ <dt>finger://</dt>
+ <dd>Finger URLs are interpreted as follows:
+ <ul class="Bl-bullet Bl-compact">
+ <li>the host is determined by the host name portion of the URL</li>
+ <li>if the user portion of the URL is provided, it's interpreted as the
+ user to finger, otherwise the path component will be used</li>
+ </ul>
+ thus <a class="Lk" href="finger://user@hostname">finger://user@hostname</a>
+ and <a class="Lk" href="finger://hostname/user">finger://hostname/user</a>
+ are treated as the same URL.</dd>
+ <dt>gemini://</dt>
+ <dd>Gemini is fully supported, with the exception of client-certificates.</dd>
+ <dt>gopher://</dt>
+ <dd>Gopher support is limited to items type 0, 1 and 7. All text is assumed to
+ be encoded in UTF-8 (or ASCII).</dd>
+</dl>
+<p class="Pp">User-entered URLs, given as argument on the command line or
+ entered with <code class="Ic">load-url</code>, are intepreted with a simple
+ heuristic:</p>
+<ul class="Bl-bullet Bl-compact">
+ <li>if it's a proper absolute URL then use it as-is,</li>
+ <li>if it starts with &#x201C;./&#x201D; or &#x201C;/&#x201D; assume it's a
+ file:// URL,</li>
+ <li>otherwise assume it's a Gemini URL.</li>
+</ul>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="DEFAULT_KEY_BINDINGS"><a class="permalink" href="#DEFAULT_KEY_BINDINGS">DEFAULT
+ KEY BINDINGS</a></h1>
+<p class="Pp">The default key bindings are very similar to GNU Emacs, but care
+ has been taken to include also bindings familiar for <a class="Xr">vi(1)</a>
+ and &#x201C;CUA&#x201D; users. In the following examples, C-x means
+ Control-x, M-x means Meta-x, where the Meta key may be either a special key
+ on the keyboard or the ALT key; otherwise ESC followed by the key X works as
+ well, and C-M-x means to press the key X together with both Control and
+ Meta.</p>
+<p class="Pp">Keys are usually a single character, like &#x2018;p&#x2019; or
+ &#x2018;n&#x2019;, but some special keys are accepted as well.</p>
+<p class="Pp"></p>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>&lt;up&gt;</dt>
+ <dd>Up arrow</dd>
+ <dt>&lt;down&gt;</dt>
+ <dd>Down arrow</dd>
+ <dt>&lt;left&gt;</dt>
+ <dd>Left arrow</dd>
+ <dt>&lt;right&gt;</dt>
+ <dd>Right arrow</dd>
+ <dt>&lt;prior&gt;</dt>
+ <dd>Previous page/Page up</dd>
+ <dt>&lt;next&gt;</dt>
+ <dd>Next page/Page down</dd>
+ <dt>&lt;home&gt;</dt>
+ <dd>Home</dd>
+ <dt>&lt;end&gt;</dt>
+ <dd>End</dd>
+ <dt>&lt;f0&gt; thru &lt;f63&gt;</dt>
+ <dd>Function keys</dd>
+ <dt>del or backspace</dt>
+ <dd>Backspace</dd>
+ <dt>esc</dt>
+ <dd>Escape</dd>
+ <dt>space or spc</dt>
+ <dd>Space</dd>
+ <dt>enter or ret</dt>
+ <dd>Enter</dd>
+ <dt>tab</dt>
+ <dd>Tab</dd>
+ <dt>backtab</dt>
+ <dd>Depends on the configuration of the terminal emulator; usually shift
+ tab.</dd>
+</dl>
+</div>
+<section class="Ss">
+<h2 class="Ss" id="GNU_Emacs-like_keys"><a class="permalink" href="#GNU_Emacs-like_keys">GNU
+ Emacs-like keys</a></h2>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>C-p</dt>
+ <dd>previous-line</dd>
+ <dt>C-n</dt>
+ <dd>next-line</dd>
+ <dt>C-f</dt>
+ <dd>forward-char</dd>
+ <dt>C-b</dt>
+ <dd>backward-char</dd>
+ <dt>M-{</dt>
+ <dd>backward-paragraph</dd>
+ <dt>M-}</dt>
+ <dd>forward-paragraph</dd>
+ <dt>C-a</dt>
+ <dd>move-beginning-of-line</dd>
+ <dt>C-e</dt>
+ <dd>move-end-of-line</dd>
+ <dt>M-v, M-space</dt>
+ <dd>scroll-up</dd>
+ <dt>C-v, space</dt>
+ <dd>scroll-down</dd>
+ <dt>M-&lt;</dt>
+ <dd>beginning-of-buffer</dd>
+ <dt>M-&gt;</dt>
+ <dd>end-of-buffer</dd>
+ <dt>C-x C-c</dt>
+ <dd>kill-telescope</dd>
+ <dt>C-g</dt>
+ <dd>clear-minibuf</dd>
+ <dt>M-x</dt>
+ <dd>execute-extended-command</dd>
+ <dt>C-c {</dt>
+ <dd>dec-fill-column</dd>
+ <dt>C-c }</dt>
+ <dd>inc-fill-column</dd>
+ <dt>C-c p</dt>
+ <dd>previous-heading</dd>
+ <dt>C-c n</dt>
+ <dd>next-heading</dd>
+ <dt>&gt;</dt>
+ <dd>load-url</dd>
+ <dt>&lt;</dt>
+ <dd>load-current-url</dd>
+ <dt>C-x C-f</dt>
+ <dd>load-url</dd>
+ <dt>C-x M-f</dt>
+ <dd>load-current-url</dd>
+ <dt>C-x o</dt>
+ <dd>other-window</dd>
+ <dt>C-x t 0</dt>
+ <dd>tab-close</dd>
+ <dt>C-x t 1</dt>
+ <dd>tab-close-other</dd>
+ <dt>C-x t 2</dt>
+ <dd>tab-new</dd>
+ <dt>C-x t o</dt>
+ <dd>tab-next</dd>
+ <dt>C-x t O</dt>
+ <dd>tab-previous</dd>
+ <dt>C-x t m</dt>
+ <dd>tab-move</dd>
+ <dt>C-x t M</dt>
+ <dd>tab-move-to</dd>
+ <dt>B, C-M-b</dt>
+ <dd>previous-page</dd>
+ <dt>F, C-M-f</dt>
+ <dd>next-page</dd>
+ <dt>&lt;f7&gt; a</dt>
+ <dd>bookmark-page</dd>
+ <dt>&lt;f7&gt; &lt;f7&gt;</dt>
+ <dd>list-bookmarks</dd>
+ <dt>C-z</dt>
+ <dd>suspend-telescope</dd>
+</dl>
+</div>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="vi_1_-like_keys"><a class="permalink" href="#vi_1_-like_keys"><a class="Xr">vi(1)</a>-like
+ keys</a></h2>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>k</dt>
+ <dd>previous-line</dd>
+ <dt>j</dt>
+ <dd>next-line</dd>
+ <dt>l</dt>
+ <dd>forward-char</dd>
+ <dt>h</dt>
+ <dd>backward-char</dd>
+ <dt>{</dt>
+ <dd>backward-paragraph</dd>
+ <dt>}</dt>
+ <dd>forward-paragraph</dd>
+ <dt>^</dt>
+ <dd>move-beginning-of-line</dd>
+ <dt>$</dt>
+ <dd>move-end-of-line</dd>
+ <dt>K</dt>
+ <dd>scroll-line-up</dd>
+ <dt>J</dt>
+ <dd>scroll-line-down</dd>
+ <dt>g g</dt>
+ <dd>beginning-of-buffer</dd>
+ <dt>G</dt>
+ <dd>end-of-buffer</dd>
+ <dt>g D</dt>
+ <dd>tab-close</dd>
+ <dt>g N</dt>
+ <dd>tab-new</dd>
+ <dt>g t</dt>
+ <dd>tab-next</dd>
+ <dt>g T</dt>
+ <dd>tab-previous</dd>
+ <dt>g M-t</dt>
+ <dd>tab-move</dd>
+ <dt>g M-T</dt>
+ <dd>tab-move-to</dd>
+ <dt>H</dt>
+ <dd>previous-page</dd>
+ <dt>L</dt>
+ <dd>next-page</dd>
+ <dt>q</dt>
+ <dd>kill-telescope</dd>
+ <dt>ESC</dt>
+ <dd>clear-minibuf</dd>
+ <dt>:</dt>
+ <dd>execute-extended-command</dd>
+</dl>
+</div>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="CUA-like_keys"><a class="permalink" href="#CUA-like_keys">CUA-like
+ keys</a></h2>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>&lt;up&gt;</dt>
+ <dd>previous-line</dd>
+ <dt>&lt;down&gt;</dt>
+ <dd>next-line</dd>
+ <dt>&lt;right&gt;</dt>
+ <dd>forward-char</dd>
+ <dt>&lt;left&gt;</dt>
+ <dd>backward-char</dd>
+ <dt>&lt;home&gt;</dt>
+ <dd>move-beginning-of-line</dd>
+ <dt>&lt;end&gt;</dt>
+ <dd>move-end-of-line</dd>
+ <dt>&lt;prior&gt;</dt>
+ <dd>scroll-up</dd>
+ <dt>&lt;next&gt;</dt>
+ <dd>scroll-down</dd>
+ <dt>C-w</dt>
+ <dd>tab-close</dd>
+ <dt>C-t</dt>
+ <dd>tab-new</dd>
+ <dt>M-&lt;prior&gt;</dt>
+ <dd>tab-previous</dd>
+ <dt>M-&lt;next&gt;</dt>
+ <dd>tab-next</dd>
+ <dt>M-&lt;left&gt;</dt>
+ <dd>previous-page</dd>
+ <dt>M-&lt;right&gt;</dt>
+ <dd>next-page</dd>
+ <dt>&lt;f5&gt;</dt>
+ <dd>reload-page</dd>
+ <dt>r</dt>
+ <dd>reload-page</dd>
+</dl>
+</div>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Neither_Emacs_nor_vi_specific"><a class="permalink" href="#Neither_Emacs_nor_vi_specific">Neither
+ Emacs nor vi specific</a></h2>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>&lt;f1&gt;</dt>
+ <dd>toggle-help</dd>
+ <dt>enter</dt>
+ <dd>push-button</dd>
+ <dt>M-enter</dt>
+ <dd>push-button-new-tab</dd>
+ <dt>M-tab</dt>
+ <dd>previous-button</dd>
+ <dt>backtab</dt>
+ <dd>previous-button</dd>
+ <dt>tab</dt>
+ <dd>next-button</dd>
+ <dt>M-t</dt>
+ <dd>tab-select</dd>
+ <dt>[</dt>
+ <dd>tab-previous</dd>
+ <dt>]</dt>
+ <dd>tab-next</dd>
+ <dt>M-[</dt>
+ <dd>tab-move-to</dd>
+ <dt>M-]</dt>
+ <dd>tab-move</dd>
+ <dt>M-l</dt>
+ <dd>link-select</dd>
+ <dt>M-/</dt>
+ <dd>swiper</dd>
+</dl>
+</div>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Minibuffer-specific_keys"><a class="permalink" href="#Minibuffer-specific_keys">Minibuffer-specific
+ keys</a></h2>
+<div class="Bd-indent">
+<dl class="Bl-tag Bl-compact">
+ <dt>enter</dt>
+ <dd>mini-complete-and-exit</dd>
+ <dt>C-g</dt>
+ <dd>mini-abort</dd>
+ <dt>ESC</dt>
+ <dd>mini-abort</dd>
+ <dt>C-d</dt>
+ <dd>mini-delete-char</dd>
+ <dt>del</dt>
+ <dd>mini-delete-backward-char</dd>
+ <dt>backspace</dt>
+ <dd>mini-delete-backward-char</dd>
+ <dt>C-h</dt>
+ <dd>mini-delete-backward-char</dd>
+ <dt>C-b</dt>
+ <dd>backward-char</dd>
+ <dt>C-f</dt>
+ <dd>forward-char</dd>
+ <dt>&lt;left&gt;</dt>
+ <dd>backward-char</dd>
+ <dt>&lt;right&gt;</dt>
+ <dd>forward-char</dd>
+ <dt>C-e</dt>
+ <dd>move-end-of-line</dd>
+ <dt>C-a</dt>
+ <dd>move-beginning-of-line</dd>
+ <dt>&lt;end&gt;</dt>
+ <dd>move-end-of-line</dd>
+ <dt>&lt;home&gt;</dt>
+ <dd>move-beginning-of-line</dd>
+ <dt>C-k</dt>
+ <dd>mini-kill-line</dd>
+ <dt>M-p</dt>
+ <dd>mini-previous-history-element</dd>
+ <dt>M-n</dt>
+ <dd>mini-next-history-element</dd>
+ <dt>C-p</dt>
+ <dd>previous-completion</dd>
+ <dt>C-n</dt>
+ <dd>next-completion</dd>
+ <dt>&lt;up&gt;</dt>
+ <dd>previous-completion</dd>
+ <dt>&lt;down&gt;</dt>
+ <dd>next-completion</dd>
+ <dt>tab</dt>
+ <dd>insert-current-candidate</dd>
+ <dt>M-&lt;</dt>
+ <dd>mini-goto-beginning</dd>
+ <dt>M-&gt;</dt>
+ <dd>mini-goto-end</dd>
+</dl>
+</div>
+</section>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="INTERACTIVE_COMMANDS"><a class="permalink" href="#INTERACTIVE_COMMANDS">INTERACTIVE
+ COMMANDS</a></h1>
+<p class="Pp">Follows the documentation for the interactive commands. These
+ commands can be bound to a key or executed with
+ <code class="Ic">execute-extended-command</code>.</p>
+<section class="Ss">
+<h2 class="Ss" id="Movement_commands"><a class="permalink" href="#Movement_commands">Movement
+ commands</a></h2>
+<dl class="Bl-tag Bl-compact">
+ <dt id="backward-char"><a class="permalink" href="#backward-char"><code class="Ic">backward-char</code></a></dt>
+ <dd>Move point one character backward.</dd>
+ <dt id="backward-paragraph"><a class="permalink" href="#backward-paragraph"><code class="Ic">backward-paragraph</code></a></dt>
+ <dd>Move point one paragraph backward.</dd>
+ <dt id="beginning-of-buffer"><a class="permalink" href="#beginning-of-buffer"><code class="Ic">beginning-of-buffer</code></a></dt>
+ <dd>Move point to the beginning of the buffer.</dd>
+ <dt id="end-of-buffer"><a class="permalink" href="#end-of-buffer"><code class="Ic">end-of-buffer</code></a></dt>
+ <dd>Move point to the end of the buffer.</dd>
+ <dt id="forward-char"><a class="permalink" href="#forward-char"><code class="Ic">forward-char</code></a></dt>
+ <dd>Move point one character forward.</dd>
+ <dt id="forward-paragraph"><a class="permalink" href="#forward-paragraph"><code class="Ic">forward-paragraph</code></a></dt>
+ <dd>Move point one paragraph forward.</dd>
+ <dt id="insert-current-candidate"><a class="permalink" href="#insert-current-candidate"><code class="Ic">insert-current-candidate</code></a></dt>
+ <dd>Copy the current selection text as minibuffer input.</dd>
+ <dt id="move-beginning-of-line"><a class="permalink" href="#move-beginning-of-line"><code class="Ic">move-beginning-of-line</code></a></dt>
+ <dd>Move point at the beginning of the current (visual) line.</dd>
+ <dt id="move-end-of-line"><a class="permalink" href="#move-end-of-line"><code class="Ic">move-end-of-line</code></a></dt>
+ <dd>Move point at the end of the current (visual) line.</dd>
+ <dt id="next-button"><a class="permalink" href="#next-button"><code class="Ic">next-button</code></a></dt>
+ <dd>Move point to the next link.</dd>
+ <dt id="next-completion"><a class="permalink" href="#next-completion"><code class="Ic">next-completion</code></a></dt>
+ <dd>Select the next completion.</dd>
+ <dt id="next-heading"><a class="permalink" href="#next-heading"><code class="Ic">next-heading</code></a></dt>
+ <dd>Move point to the next heading.</dd>
+ <dt id="next-line"><a class="permalink" href="#next-line"><code class="Ic">next-line</code></a></dt>
+ <dd>Move point to the next (visual) line, in the same column if possible.</dd>
+ <dt id="previous-button"><a class="permalink" href="#previous-button"><code class="Ic">previous-button</code></a></dt>
+ <dd>Move point to the previous link.</dd>
+ <dt id="previous-completion"><a class="permalink" href="#previous-completion"><code class="Ic">previous-completion</code></a></dt>
+ <dd>Select the previous completion.</dd>
+ <dt id="previous-heading"><a class="permalink" href="#previous-heading"><code class="Ic">previous-heading</code></a></dt>
+ <dd>Move point to the previous heading.</dd>
+ <dt id="previous-line"><a class="permalink" href="#previous-line"><code class="Ic">previous-line</code></a></dt>
+ <dd>Move point to the previous (visual) line.</dd>
+</dl>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Bookmark-related_commands"><a class="permalink" href="#Bookmark-related_commands">Bookmark-related
+ commands</a></h2>
+<dl class="Bl-tag Bl-compact">
+ <dt id="bookmark-page"><a class="permalink" href="#bookmark-page"><code class="Ic">bookmark-page</code></a></dt>
+ <dd>Save a page in the bookmark file. It preloads the minibuffer with the
+ current URL.</dd>
+ <dt id="list-bookmarks"><a class="permalink" href="#list-bookmarks"><code class="Ic">list-bookmarks</code></a></dt>
+ <dd>Load the bookmarks page.</dd>
+</dl>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Tab-related_commands"><a class="permalink" href="#Tab-related_commands">Tab-related
+ commands</a></h2>
+<dl class="Bl-tag Bl-compact">
+ <dt id="tab-close"><a class="permalink" href="#tab-close"><code class="Ic">tab-close</code></a></dt>
+ <dd>Close the current tab.</dd>
+ <dt id="tab-close-other"><a class="permalink" href="#tab-close-other"><code class="Ic">tab-close-other</code></a></dt>
+ <dd>Close all tabs but the current one.</dd>
+ <dt id="tab-move"><a class="permalink" href="#tab-move"><code class="Ic">tab-move</code></a></dt>
+ <dd>Move the current tab after the next one, wrapping around if needed.</dd>
+ <dt id="tab-move-to"><a class="permalink" href="#tab-move-to"><code class="Ic">tab-move-to</code></a></dt>
+ <dd>Move the current tab before the previous one, wrapping around if
+ needed.</dd>
+ <dt id="tab-new"><a class="permalink" href="#tab-new"><code class="Ic">tab-new</code></a></dt>
+ <dd>Open a new tab.</dd>
+ <dt id="tab-next"><a class="permalink" href="#tab-next"><code class="Ic">tab-next</code></a></dt>
+ <dd>Focus next tab, wrapping around eventually.</dd>
+ <dt id="tab-previous"><a class="permalink" href="#tab-previous"><code class="Ic">tab-previous</code></a></dt>
+ <dd>Focus the previous tab, wrapping around eventually.</dd>
+ <dt id="tab-select"><a class="permalink" href="#tab-select"><code class="Ic">tab-select</code></a></dt>
+ <dd>Switch to a tab using the minibuffer.</dd>
+</dl>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Misc_commands"><a class="permalink" href="#Misc_commands">Misc
+ commands</a></h2>
+<dl class="Bl-tag Bl-compact">
+ <dt id="clear-minibuf"><a class="permalink" href="#clear-minibuf"><code class="Ic">clear-minibuf</code></a></dt>
+ <dd>Clear the echo area.</dd>
+ <dt id="dec-fill-column"><a class="permalink" href="#dec-fill-column"><code class="Ic">dec-fill-column</code></a></dt>
+ <dd>Decrement fill-column by two.</dd>
+ <dt id="execute-extended-command"><a class="permalink" href="#execute-extended-command"><code class="Ic">execute-extended-command</code></a></dt>
+ <dd>Execute an internal command.</dd>
+ <dt id="kill-telescope"><a class="permalink" href="#kill-telescope"><code class="Ic">kill-telescope</code></a></dt>
+ <dd>Quit <code class="Nm">telescope</code>.</dd>
+ <dt id="inc-fill-column"><a class="permalink" href="#inc-fill-column"><code class="Ic">inc-fill-column</code></a></dt>
+ <dd>Increment fill-column by two.</dd>
+ <dt id="link-select"><a class="permalink" href="#link-select"><code class="Ic">link-select</code></a></dt>
+ <dd>Select and visit a link using the minibuffer.</dd>
+ <dt id="load-current-url"><a class="permalink" href="#load-current-url"><code class="Ic">load-current-url</code></a></dt>
+ <dd>Edit the current URL.</dd>
+ <dt id="load-url"><a class="permalink" href="#load-url"><code class="Ic">load-url</code></a></dt>
+ <dd>Prompt for an URL.</dd>
+ <dt id="next-page"><a class="permalink" href="#next-page"><code class="Ic">next-page</code></a></dt>
+ <dd>Go forward in the page history.</dd>
+ <dt id="olivetti-mode"><a class="permalink" href="#olivetti-mode"><code class="Ic">olivetti-mode</code></a></dt>
+ <dd>Toggle olivetti mode (i.e. horizontal centering of the lines of the
+ window.)</dd>
+ <dt id="other-window"><a class="permalink" href="#other-window"><code class="Ic">other-window</code></a></dt>
+ <dd>Select the other window.</dd>
+ <dt id="previous-page"><a class="permalink" href="#previous-page"><code class="Ic">previous-page</code></a></dt>
+ <dd>Go backward in the page history.</dd>
+ <dt id="push-button"><a class="permalink" href="#push-button"><code class="Ic">push-button</code></a></dt>
+ <dd>Follow link at point, or toggle the visibility of the following
+ preformatted block if called when the cursor is on the heading of the
+ block.</dd>
+ <dt id="push-button-new-tab"><a class="permalink" href="#push-button-new-tab"><code class="Ic">push-button-new-tab</code></a></dt>
+ <dd>Follow link at point in a new tab.</dd>
+ <dt id="redraw"><a class="permalink" href="#redraw"><code class="Ic">redraw</code></a></dt>
+ <dd>Redraw the screen, useful if some background program messed up the
+ display.</dd>
+ <dt id="reload-page"><a class="permalink" href="#reload-page"><code class="Ic">reload-page</code></a></dt>
+ <dd>Reload the current page.</dd>
+ <dt id="scroll-down"><a class="permalink" href="#scroll-down"><code class="Ic">scroll-down</code></a></dt>
+ <dd>Scroll down by one visual page.</dd>
+ <dt id="scroll-line-down"><a class="permalink" href="#scroll-line-down"><code class="Ic">scroll-line-down</code></a></dt>
+ <dd>Scroll down by one line.</dd>
+ <dt id="scroll-line-up"><a class="permalink" href="#scroll-line-up"><code class="Ic">scroll-line-up</code></a></dt>
+ <dd>Scroll up by one line.</dd>
+ <dt id="scroll-up"><a class="permalink" href="#scroll-up"><code class="Ic">scroll-up</code></a></dt>
+ <dd>Scroll up by one visual page.</dd>
+ <dt id="suspend-telescope"><a class="permalink" href="#suspend-telescope"><code class="Ic">suspend-telescope</code></a></dt>
+ <dd>Suspend the current <code class="Nm">telescope</code> session.</dd>
+ <dt id="swiper"><a class="permalink" href="#swiper"><code class="Ic">swiper</code></a></dt>
+ <dd>Jump to a line using the minibuffer.</dd>
+ <dt id="toc"><a class="permalink" href="#toc"><code class="Ic">toc</code></a></dt>
+ <dd>Jump to a heading using the minibuffer.</dd>
+ <dt id="toggle-help"><a class="permalink" href="#toggle-help"><code class="Ic">toggle-help</code></a></dt>
+ <dd>Toggle side window with help about available keys and their associated
+ interactive command.</dd>
+ <dt id="toggle-pre-wrap"><a class="permalink" href="#toggle-pre-wrap"><code class="Ic">toggle-pre-wrap</code></a></dt>
+ <dd>Toggle the wrapping of preformatted blocks.</dd>
+</dl>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Minibuffer_commands"><a class="permalink" href="#Minibuffer_commands">Minibuffer
+ commands</a></h2>
+<dl class="Bl-tag Bl-compact">
+ <dt id="mini-abort"><a class="permalink" href="#mini-abort"><code class="Ic">mini-abort</code></a></dt>
+ <dd>Abort the current minibuffer action.</dd>
+ <dt id="mini-complete-and-exit"><a class="permalink" href="#mini-complete-and-exit"><code class="Ic">mini-complete-and-exit</code></a></dt>
+ <dd>Complete the current minibuffer action.</dd>
+ <dt id="mini-delete-backward-char"><a class="permalink" href="#mini-delete-backward-char"><code class="Ic">mini-delete-backward-char</code></a></dt>
+ <dd>Delete the character before the point.</dd>
+ <dt id="mini-delete-char"><a class="permalink" href="#mini-delete-char"><code class="Ic">mini-delete-char</code></a></dt>
+ <dd>Delete the character after the point.</dd>
+ <dt id="mini-goto-beginning"><a class="permalink" href="#mini-goto-beginning"><code class="Ic">mini-goto-beginning</code></a></dt>
+ <dd>Select the first completion, if any.</dd>
+ <dt id="mini-goto-end"><a class="permalink" href="#mini-goto-end"><code class="Ic">mini-goto-end</code></a></dt>
+ <dd>Select the last completion, if any.</dd>
+ <dt id="mini-kill-line"><a class="permalink" href="#mini-kill-line"><code class="Ic">mini-kill-line</code></a></dt>
+ <dd>Delete from point until the end of the line.</dd>
+ <dt id="mini-next-history-element"><a class="permalink" href="#mini-next-history-element"><code class="Ic">mini-next-history-element</code></a></dt>
+ <dd>Load the previous history element.</dd>
+ <dt id="mini-previous-history-element"><a class="permalink" href="#mini-previous-history-element"><code class="Ic">mini-previous-history-element</code></a></dt>
+ <dd>Load the next history element.</dd>
+</dl>
+</section>
+<section class="Ss">
+<h2 class="Ss" id="Aliases"><a class="permalink" href="#Aliases">Aliases</a></h2>
+<p class="Pp">The following aliases are available during
+ <code class="Ic">execute-extended-command</code>:</p>
+<dl class="Bl-tag Bl-compact">
+ <dt id="tabn"><a class="permalink" href="#tabn"><code class="Ic">tabn</code></a></dt>
+ <dd><a class="permalink" href="#tab-next~2"><code class="Ic" id="tab-next~2">tab-next</code></a></dd>
+ <dt id="tabnew"><a class="permalink" href="#tabnew"><code class="Ic">tabnew</code></a></dt>
+ <dd><a class="permalink" href="#tab-new~2"><code class="Ic" id="tab-new~2">tab-new</code></a></dd>
+ <dt id="tabp"><a class="permalink" href="#tabp"><code class="Ic">tabp</code></a></dt>
+ <dd><a class="permalink" href="#tab-previous~2"><code class="Ic" id="tab-previous~2">tab-previous</code></a></dd>
+ <dt id="q"><a class="permalink" href="#q"><code class="Ic">q</code></a>
+ <span class="No">and</span> <code class="Ic">wq</code></dt>
+ <dd><a class="permalink" href="#kill-telescope~2"><code class="Ic" id="kill-telescope~2">kill-telescope</code></a></dd>
+</dl>
+</section>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="CONFIGURATION_FILE"><a class="permalink" href="#CONFIGURATION_FILE">CONFIGURATION
+ FILE</a></h1>
+<p class="Pp">During the startup, <code class="Nm">telescope</code> reads the
+ configuration file at <span class="Pa">~/.telescope/config</span> or the one
+ given with the <code class="Fl">-c</code> flag.</p>
+<p class="Pp"><code class="Nm">telescope</code> will also load a file called
+ <span class="Pa">config-TERM</span>, where &#x201C;TERM&#x201D; is the name
+ of the terminal type (i.e. the TERM environment variable), if it exists.</p>
+<p class="Pp">The format of the configuration file is fairly flexible. The
+ current line can be extended over multiple ones using a backslash
+ (&#x2018;\&#x2019;). Comments can be put anywhere in the file using a hash
+ mark (&#x2018;#&#x2019;), and extend to the end of the current line, but
+ backslashes can't be used to extend comments over multiple lines.</p>
+<p class="Pp">The following constructs are available:</p>
+<dl class="Bl-tag">
+ <dt id="bind"><a class="permalink" href="#bind"><code class="Ic">bind</code></a>
+ <var class="Ar">map</var> <var class="Ar">key</var>
+ <var class="Ar">cmd</var></dt>
+ <dd>Bind <var class="Ar">key</var> to the function <var class="Ar">cmd</var>
+ in the keymap <var class="Ar">map</var>. Valid values for map are
+ &#x201C;global-map&#x201D; (i.e. when the user is viewing a page) and
+ &#x201C;minibuffer-map&#x201D; (i.e. when the minibuffer has the focus.)
+ <var class="Ar">key</var> follows the same syntax described in
+ <a class="Sx" href="#DEFAULT_KEY_BINDINGS">DEFAULT KEY BINDINGS</a> and
+ all the possible functions are listed in
+ <a class="Sx" href="#INTERACTIVE_COMMANDS">INTERACTIVE COMMANDS</a>.</dd>
+ <dt id="proxy"><a class="permalink" href="#proxy"><code class="Ic">proxy</code></a>
+ <var class="Ar">proto</var> <code class="Ic">via</code>
+ <var class="Ar">url</var></dt>
+ <dd>Use <var class="Ar">url</var> as proxy for all URLs with protocol
+ <var class="Ar">proto</var>. <var class="Ar">url</var> must be a Gemini
+ URI without path, query and fragment component.</dd>
+ <dt id="set"><a class="permalink" href="#set"><code class="Ic">set</code></a>
+ <var class="Ar">opt</var> <span class="No">=</span>
+ <var class="Ar">val</var></dt>
+ <dd>Set the option <var class="Ar">opt</var> to the value
+ <var class="Ar">val</var>. Valid options are:
+ <p class="Pp"></p>
+ <dl class="Bl-tag Bl-compact">
+ <dt>autosave</dt>
+ <dd>(integer) If greater than zero, save the session after the specified
+ amount of seconds after some events happens (new or closed tabs,
+ visited a link ...) Defaults to 20.</dd>
+ <dt>dont-wrap-pre</dt>
+ <dd>(integer) If nonzero, don't wrap preformatted blocks. Defaults to
+ 0.</dd>
+ <dt>emojify-link</dt>
+ <dd>(integer) If nonzero, when the text of a link starts with an emoji
+ followed by a space, use that emoji as line prefix. Defaults to
+ 1.</dd>
+ <dt>enable-colors</dt>
+ <dd>(integer) If nonzero, enable colours. Defaults to 0 if
+ <code class="Ev">NO_COLORS</code> is set, 1 otherwise.</dd>
+ <dt>fill-column</dt>
+ <dd>(integer) If greater than zero, lines of text will be formatted in a
+ way that don't exceed the given number of columns. Defaults to
+ 80.</dd>
+ <dt>hide-pre-blocks</dt>
+ <dd>(integer) If nonzero, hide by default the body of the preformatted
+ blocks. Defaults to zero. <code class="Ic">push-button</code> can be
+ used to toggle the visibility per-block.</dd>
+ <dt>hide-pre-closing-line</dt>
+ <dd>(integer) If nonzero, hide the closing line of preformatted blocks.
+ Defaults to 0.</dd>
+ <dt>hide-pre-context</dt>
+ <dd>(integer) If nonzero, hide the start and end line of the preformatted
+ blocks. If both hide-pre-context and hide-pre-blocks are nonzero,
+ preformatted blocks are irremediably hidden. Defaults to zero.</dd>
+ <dt>new-tab-url</dt>
+ <dd>(string) URL for the new tab page. Defaults to
+ &#x201C;about:new&#x201D;.</dd>
+ <dt>olivetti-mode</dt>
+ <dd>(integer) If nonzero, enable <code class="Ic">olivetti-mode</code>
+ Defaults to 1.</dd>
+ <dt>set-title</dt>
+ <dd>(integer) If nonzero, set the terminal title to the page title.
+ Defaults to 1.</dd>
+ <dt>tab-bar-show</dt>
+ <dd>(integer) If tab-bar-show is -1 hide the tab bar permanently, if 0
+ show it unconditionally. If it's 1, show the bar only when there is
+ more than one tab. Defaults to 1.</dd>
+ </dl>
+ </dd>
+ <dt id="style"><a class="permalink" href="#style"><code class="Ic">style</code></a>
+ <var class="Ar">name</var> <var class="Ar">option</var></dt>
+ <dd>Change the styling of the element identified by
+ <var class="Ar">name</var>. Multiple options may be specified within curly
+ braces. Valid style identifiers are:
+ <div class="Bd-indent">
+ <dl class="Bl-tag Bl-compact">
+ <dt>line</dt>
+ <dd>the area outside the lines in the body of the page.</dd>
+ <dt>line.compl</dt>
+ <dd>the completions.</dd>
+ <dt>line.compl.current</dt>
+ <dd>the current completion.</dd>
+ <dt>line.help</dt>
+ <dd>text in the *Help* buffer.</dd>
+ <dt>line.text</dt>
+ <dd>text lines.</dd>
+ <dt>line.link</dt>
+ <dd>link lines.</dd>
+ <dt>line.title1..3</dt>
+ <dd>headings</dd>
+ <dt>line.item</dt>
+ <dd>item lines.</dd>
+ <dt>line.quote</dt>
+ <dd>quotes.</dd>
+ <dt>line.pre.start</dt>
+ <dd>the heading of a preformatted block.</dd>
+ <dt>line.pre</dt>
+ <dd>the content of a preformatted block.</dd>
+ <dt>line.pre.end</dt>
+ <dd>the closing line of a preformatted block.</dd>
+ <dt>minibuffer</dt>
+ <dd>the minibuffer.</dd>
+ <dt>modeline</dt>
+ <dd>the modeline.</dd>
+ <dt>tabline</dt>
+ <dd>the tabline.</dd>
+ <dt>tabline.tab</dt>
+ <dd>the non-focused tabs.</dd>
+ <dt>tabline.current</dt>
+ <dd>the focused tab.</dd>
+ </dl>
+ </div>
+ <p class="Pp">Valid options are:</p>
+ <dl class="Bl-tag">
+ <dt id="attr"><a class="permalink" href="#attr"><code class="Ic">attr</code></a>
+ <var class="Ar">prefix</var> [<var class="Ar">line</var>
+ [<var class="Ar">trail</var>]]</dt>
+ <dd>Sets the text attributes. If only one value is given,
+ <var class="Ar">line</var> and <var class="Ar">trail</var> default to
+ that; if two values are given then <var class="Ar">trail</var>
+ defaults to <var class="Ar">prefix</var>. Each attribute is a
+ comma-separated list of keywords:
+ <div class="Bd-indent">
+ <dl class="Bl-tag Bl-compact">
+ <dt id="normal"><a class="permalink" href="#normal"><code class="Ic">normal</code></a></dt>
+ <dd>no attributes.</dd>
+ <dt id="standout"><a class="permalink" href="#standout"><code class="Ic">standout</code></a></dt>
+ <dd>best highlighting mode for the terminal.</dd>
+ <dt id="underline"><a class="permalink" href="#underline"><code class="Ic">underline</code></a></dt>
+ <dd>underlines the text.</dd>
+ <dt id="reverse"><a class="permalink" href="#reverse"><code class="Ic">reverse</code></a></dt>
+ <dd>reverses background/foreground colors.</dd>
+ <dt id="blink"><a class="permalink" href="#blink"><code class="Ic">blink</code></a></dt>
+ <dd>makes the text blinking.</dd>
+ <dt id="dim"><a class="permalink" href="#dim"><code class="Ic">dim</code></a></dt>
+ <dd>half bright.</dd>
+ <dt id="bold"><a class="permalink" href="#bold"><code class="Ic">bold</code></a></dt>
+ <dd>extra bright or bold.</dd>
+ </dl>
+ </div>
+ <p class="Pp">Only the style identifiers with the &#x201C;line.&#x201D;
+ prefix accept up to three attributes. The other will only use the
+ first one given.</p>
+ </dd>
+ <dt id="bg"><a class="permalink" href="#bg"><code class="Ic">bg</code></a>
+ <var class="Ar">prefix</var> [<var class="Ar">line</var>
+ [<var class="Ar">trail</var>]]</dt>
+ <dd>Sets the background color. Follows the same behaviour as
+ <code class="Ic">attr</code> regarding the optional parameters. The
+ colour is one of black, red, green, yellow, blue, magenta, cyan and
+ white; colour0 to colour255 (or color0 to color255) from the
+ 256-colour set; default for the default colour.</dd>
+ <dt id="fg"><a class="permalink" href="#fg"><code class="Ic">fg</code></a>
+ <var class="Ar">prefix</var> [<var class="Ar">line</var>
+ [<var class="Ar">trail</var>]]</dt>
+ <dd>Sets the foreground color. It behaves just like
+ <code class="Ic">bg</code>.</dd>
+ <dt id="prefix"><a class="permalink" href="#prefix"><code class="Ic">prefix</code></a>
+ <var class="Ar">prfx</var> [<var class="Ar">cont</var>]</dt>
+ <dd>Sets the prefix for the current line type to
+ <var class="Ar">prfx</var> and <var class="Ar">cont</var> as the
+ prefix for the continuation lines (i.e. when a long line gets
+ wrapped.) If <var class="Ar">cont</var> is not given its value will be
+ the same of <var class="Ar">prfx</var>.</dd>
+ </dl>
+ </dd>
+</dl>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="ENVIRONMENT"><a class="permalink" href="#ENVIRONMENT">ENVIRONMENT</a></h1>
+<p class="Pp">When <code class="Nm">telescope</code> is started, it inspects the
+ following environment variables:</p>
+<dl class="Bl-tag">
+ <dt id="HOME"><a class="permalink" href="#HOME"><code class="Ev">HOME</code></a></dt>
+ <dd>The user's login directory.</dd>
+ <dt id="NO_COLORS"><a class="permalink" href="#NO_COLORS"><code class="Ev">NO_COLORS</code></a></dt>
+ <dd>To decide whether to use colors or not. The content of the variable
+ doesn't matter.</dd>
+ <dt id="TERM"><a class="permalink" href="#TERM"><code class="Ev">TERM</code></a></dt>
+ <dd>The user's terminal name.</dd>
+</dl>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
+<dl class="Bl-tag Bl-compact">
+ <dt><span class="Pa">~/.telescope/bookmarks.gmi</span></dt>
+ <dd>Bookmarks file.</dd>
+ <dt><span class="Pa">~/.telescope/config</span></dt>
+ <dd>Default configuration file.</dd>
+ <dt><span class="Pa">~/.telescope/known_hosts</span></dt>
+ <dd>Hash of the certificates for all the known hosts. Each line contains three
+ fields: hostname with optional port number, hash of the certificate and a
+ numeric flag.</dd>
+ <dt><span class="Pa">~/.telescope/lock</span></dt>
+ <dd>Lock file used to prevent multiple instance of
+ <code class="Nm">telescope</code> from running at the same time.</dd>
+ <dt><span class="Pa">~/.telescope/pages/about_*.gmi</span></dt>
+ <dd>Overrides for built-in about: pages.</dd>
+ <dt><span class="Pa">~/.telescope/session</span></dt>
+ <dd>The list of tabs from the last session. Every line identifies a tab and
+ contains three space-separated fields: the full URL, a comma-separated
+ list of attributes and the cached title. Is written by
+ <code class="Ic">kill-telescope</code> and loaded during startup.</dd>
+</dl>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
+<p class="Pp">It's possible to browse &#x201C;the small web&#x201D; (i.e. simple
+ websites) by using programs like the duckling-proxy by defining a proxy in
+ <span class="Pa">~/.telescope/config</span>:</p>
+<div class="Bd Pp Bd-indent Li">
+<pre>proxy http via &quot;gemini://127.0.0.1:1965&quot;
+proxy https via &quot;gemini://127.0.0.1:1965&quot;</pre>
+</div>
+<p class="Pp">To load <code class="Nm">telescope</code> without any
+ configuration</p>
+<div class="Bd Pp Bd-indent Li">
+<pre>telescope -c /dev/null</pre>
+</div>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
+<p class="Pp">The <code class="Nm">telescope</code> program was written by
+ <span class="An">Omar Polo</span>
+ &lt;<a class="Mt" href="mailto:op@omarpolo.com">op@omarpolo.com</a>&gt;.</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
+<p class="Pp">There's no UI for out-of-band certificates validation.</p>
+</section>
+</div>
+<table class="foot">
+ <tr>
+ <td class="foot-date">August 27, 2021</td>
+ <td class="foot-os">OpenBSD 7.0</td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/site/telescope.1.txt b/site/telescope.1.txt
new file mode 100644
index 0000000..1457102
--- /dev/null
+++ b/site/telescope.1.txt
@@ -0,0 +1,531 @@
+TELESCOPE(1) General Commands Manual TELESCOPE(1)
+
+NAME
+ telescope multi-protocol browser
+
+SYNOPSIS
+ telescope [-Chnv] [-c config] [URL]
+
+DESCRIPTION
+ telescope is an interactive browser that supports the Finger, Gemini and
+ Gopher protocols. telescope features tabs, a minibuffer, interactive
+ completions, bookmarks and out-of-band TOFU verification.
+
+ The arguments are as follows:
+
+ -C, --colors Show all available colors and exit.
+
+ -c config Specify an alternative configuration file. By default
+ $HOME/.telescope/config is loaded.
+
+ -h, --help Display version and usage.
+
+ -n Configtest mode. Only check the configuration file for
+ validity.
+
+ -v, --version Display version.
+
+UI CONCEPTS
+ telescope interface is divided into four areas: the tabline, the body,
+ the modeline and the echoarea/minibuffer.
+
+ The tabline is always at the top of the screen and displays the tabs
+ separated by a vertical line. When there are more tabs than the size of
+ the window allow to display, the characters < or > are shown at the
+ start/end of the tabline to indicate that there are more tabs in that
+ direction.
+
+ The body occupies the majority of the visible area. It contains the
+ current page and optionally a side window.
+
+ The modeline is the second to last row of the screen. It shows some
+ information about the page: a spinner when the page is loading, the trust
+ level, the document type, the scroll offset and the URL.
+
+ The echoarea is usually the last line of the screen. Messages are often
+ showed there, and link addresses too. The echoarea is also used to
+ obtain input from the user. When commands like swiper or link-select are
+ invoked, the minibuffer area grows to show possible completions.
+
+TOFU
+ telescope aims to use the Trust, but Verify (where appropriate)
+ approach for TOFU (Trust On First Use). The idea is to define three
+ level of verification for a certificate:
+
+ untrusted (!) the server fingerprint does NOT match the stored
+ value.
+
+ trusted (v) the server fingerprint matches the store one.
+
+ verified (V) the fingerprint matches and has been verified out-of-
+ band.
+
+ The trust level of the page is indicated in the modeline with the
+ indicated character.
+
+ Most of the time the trusted level is enough, but where is appropriate
+ users should be able to verify out-of-band the certificate.
+
+ At the moment, there is no built-in support for an out-of-band
+ verification though.
+
+SUPPORTED PROTOCOLS
+ The following protocols are supported:
+
+ about: About pages are telescope internal page. See about:about for
+ a list of all these pages.
+
+ file:// File types know to telescope, such as .gmi, .gemini, .txt,
+ .md, .markdown, .diff or .patch, can be viewed inside the
+ application. Types of local files are detected solely based
+ on the file extension. On some systems, such as OpenBSD, only
+ files inside special directories (like /tmp or ~/Downloads)
+ are available.
+
+ finger:// Finger URLs are interpreted as follows:
+ the host is determined by the host name portion of the URL
+ if the user portion of the URL is provided, it's
+ interpreted as the user to finger, otherwise the path
+ component will be used
+ thus finger://user@hostname and finger://hostname/user are
+ treated as the same URL.
+
+ gemini:// Gemini is fully supported, with the exception of client-
+ certificates.
+
+ gopher:// Gopher support is limited to items type 0, 1 and 7. All text
+ is assumed to be encoded in UTF-8 (or ASCII).
+
+ User-entered URLs, given as argument on the command line or entered with
+ load-url, are intepreted with a simple heuristic:
+ if it's a proper absolute URL then use it as-is,
+ if it starts with ./ or / assume it's a file:// URL,
+ otherwise assume it's a Gemini URL.
+
+DEFAULT KEY BINDINGS
+ The default key bindings are very similar to GNU Emacs, but care has been
+ taken to include also bindings familiar for vi(1) and CUA users. In
+ the following examples, C-x means Control-x, M-x means Meta-x, where the
+ Meta key may be either a special key on the keyboard or the ALT key;
+ otherwise ESC followed by the key X works as well, and C-M-x means to
+ press the key X together with both Control and Meta.
+
+ Keys are usually a single character, like p or n, but some special
+ keys are accepted as well.
+
+ <up> Up arrow
+ <down> Down arrow
+ <left> Left arrow
+ <right> Right arrow
+ <prior> Previous page/Page up
+ <next> Next page/Page down
+ <home> Home
+ <end> End
+ <f0> thru <f63> Function keys
+ del or backspace Backspace
+ esc Escape
+ space or spc Space
+ enter or ret Enter
+ tab Tab
+ backtab Depends on the configuration of the terminal
+ emulator; usually shift tab.
+
+ GNU Emacs-like keys
+ C-p previous-line
+ C-n next-line
+ C-f forward-char
+ C-b backward-char
+ M-{ backward-paragraph
+ M-} forward-paragraph
+ C-a move-beginning-of-line
+ C-e move-end-of-line
+ M-v, M-space scroll-up
+ C-v, space scroll-down
+ M-< beginning-of-buffer
+ M-> end-of-buffer
+ C-x C-c kill-telescope
+ C-g clear-minibuf
+ M-x execute-extended-command
+ C-c { dec-fill-column
+ C-c } inc-fill-column
+ C-c p previous-heading
+ C-c n next-heading
+ > load-url
+ < load-current-url
+ C-x C-f load-url
+ C-x M-f load-current-url
+ C-x o other-window
+ C-x t 0 tab-close
+ C-x t 1 tab-close-other
+ C-x t 2 tab-new
+ C-x t o tab-next
+ C-x t O tab-previous
+ C-x t m tab-move
+ C-x t M tab-move-to
+ B, C-M-b previous-page
+ F, C-M-f next-page
+ <f7> a bookmark-page
+ <f7> <f7> list-bookmarks
+ C-z suspend-telescope
+
+ vi(1)-like keys
+ k previous-line
+ j next-line
+ l forward-char
+ h backward-char
+ { backward-paragraph
+ } forward-paragraph
+ ^ move-beginning-of-line
+ $ move-end-of-line
+ K scroll-line-up
+ J scroll-line-down
+ g g beginning-of-buffer
+ G end-of-buffer
+ g D tab-close
+ g N tab-new
+ g t tab-next
+ g T tab-previous
+ g M-t tab-move
+ g M-T tab-move-to
+ H previous-page
+ L next-page
+ q kill-telescope
+ ESC clear-minibuf
+ : execute-extended-command
+
+ CUA-like keys
+ <up> previous-line
+ <down> next-line
+ <right> forward-char
+ <left> backward-char
+ <home> move-beginning-of-line
+ <end> move-end-of-line
+ <prior> scroll-up
+ <next> scroll-down
+ C-w tab-close
+ C-t tab-new
+ M-<prior> tab-previous
+ M-<next> tab-next
+ M-<left> previous-page
+ M-<right> next-page
+ <f5> reload-page
+ r reload-page
+
+ Neither Emacs nor vi specific
+ <f1> toggle-help
+ enter push-button
+ M-enter push-button-new-tab
+ M-tab previous-button
+ backtab previous-button
+ tab next-button
+ M-t tab-select
+ [ tab-previous
+ ] tab-next
+ M-[ tab-move-to
+ M-] tab-move
+ M-l link-select
+ M-/ swiper
+
+ Minibuffer-specific keys
+ enter mini-complete-and-exit
+ C-g mini-abort
+ ESC mini-abort
+ C-d mini-delete-char
+ del mini-delete-backward-char
+ backspace mini-delete-backward-char
+ C-h mini-delete-backward-char
+ C-b backward-char
+ C-f forward-char
+ <left> backward-char
+ <right> forward-char
+ C-e move-end-of-line
+ C-a move-beginning-of-line
+ <end> move-end-of-line
+ <home> move-beginning-of-line
+ C-k mini-kill-line
+ M-p mini-previous-history-element
+ M-n mini-next-history-element
+ C-p previous-completion
+ C-n next-completion
+ <up> previous-completion
+ <down> next-completion
+ tab insert-current-candidate
+ M-< mini-goto-beginning
+ M-> mini-goto-end
+
+INTERACTIVE COMMANDS
+ Follows the documentation for the interactive commands. These commands
+ can be bound to a key or executed with execute-extended-command.
+
+ Movement commands
+ backward-char Move point one character backward.
+ backward-paragraph Move point one paragraph backward.
+ beginning-of-buffer Move point to the beginning of the buffer.
+ end-of-buffer Move point to the end of the buffer.
+ forward-char Move point one character forward.
+ forward-paragraph Move point one paragraph forward.
+ insert-current-candidate Copy the current selection text as minibuffer
+ input.
+ move-beginning-of-line Move point at the beginning of the current
+ (visual) line.
+ move-end-of-line Move point at the end of the current (visual)
+ line.
+ next-button Move point to the next link.
+ next-completion Select the next completion.
+ next-heading Move point to the next heading.
+ next-line Move point to the next (visual) line, in the
+ same column if possible.
+ previous-button Move point to the previous link.
+ previous-completion Select the previous completion.
+ previous-heading Move point to the previous heading.
+ previous-line Move point to the previous (visual) line.
+
+ Bookmark-related commands
+ bookmark-page Save a page in the bookmark file. It preloads
+ the minibuffer with the current URL.
+ list-bookmarks Load the bookmarks page.
+
+ Tab-related commands
+ tab-close Close the current tab.
+ tab-close-other Close all tabs but the current one.
+ tab-move Move the current tab after the next one,
+ wrapping around if needed.
+ tab-move-to Move the current tab before the previous one,
+ wrapping around if needed.
+ tab-new Open a new tab.
+ tab-next Focus next tab, wrapping around eventually.
+ tab-previous Focus the previous tab, wrapping around
+ eventually.
+ tab-select Switch to a tab using the minibuffer.
+
+ Misc commands
+ clear-minibuf Clear the echo area.
+ dec-fill-column Decrement fill-column by two.
+ execute-extended-command Execute an internal command.
+ kill-telescope Quit telescope.
+ inc-fill-column Increment fill-column by two.
+ link-select Select and visit a link using the minibuffer.
+ load-current-url Edit the current URL.
+ load-url Prompt for an URL.
+ next-page Go forward in the page history.
+ olivetti-mode Toggle olivetti mode (i.e. horizontal centering
+ of the lines of the window.)
+ other-window Select the other window.
+ previous-page Go backward in the page history.
+ push-button Follow link at point, or toggle the visibility
+ of the following preformatted block if called
+ when the cursor is on the heading of the block.
+ push-button-new-tab Follow link at point in a new tab.
+ redraw Redraw the screen, useful if some background
+ program messed up the display.
+ reload-page Reload the current page.
+ scroll-down Scroll down by one visual page.
+ scroll-line-down Scroll down by one line.
+ scroll-line-up Scroll up by one line.
+ scroll-up Scroll up by one visual page.
+ suspend-telescope Suspend the current telescope session.
+ swiper Jump to a line using the minibuffer.
+ toc Jump to a heading using the minibuffer.
+ toggle-help Toggle side window with help about available
+ keys and their associated interactive command.
+ toggle-pre-wrap Toggle the wrapping of preformatted blocks.
+
+ Minibuffer commands
+ mini-abort Abort the current minibuffer action.
+ mini-complete-and-exit Complete the current minibuffer action.
+ mini-delete-backward-char
+ Delete the character before the point.
+ mini-delete-char Delete the character after the point.
+ mini-goto-beginning Select the first completion, if any.
+ mini-goto-end Select the last completion, if any.
+ mini-kill-line Delete from point until the end of the line.
+ mini-next-history-element
+ Load the previous history element.
+ mini-previous-history-element
+ Load the next history element.
+
+ Aliases
+ The following aliases are available during execute-extended-command:
+ tabn tab-next
+ tabnew tab-new
+ tabp tab-previous
+ q and wq kill-telescope
+
+CONFIGURATION FILE
+ During the startup, telescope reads the configuration file at
+ ~/.telescope/config or the one given with the -c flag.
+
+ telescope will also load a file called config-TERM, where TERM is the
+ name of the terminal type (i.e. the TERM environment variable), if it
+ exists.
+
+ The format of the configuration file is fairly flexible. The current
+ line can be extended over multiple ones using a backslash (\).
+ Comments can be put anywhere in the file using a hash mark (#), and
+ extend to the end of the current line, but backslashes can't be used to
+ extend comments over multiple lines.
+
+ The following constructs are available:
+
+ bind map key cmd
+ Bind key to the function cmd in the keymap map. Valid values for
+ map are global-map (i.e. when the user is viewing a page) and
+ minibuffer-map (i.e. when the minibuffer has the focus.) key
+ follows the same syntax described in DEFAULT KEY BINDINGS and all
+ the possible functions are listed in INTERACTIVE COMMANDS.
+
+ proxy proto via url
+ Use url as proxy for all URLs with protocol proto. url must be a
+ Gemini URI without path, query and fragment component.
+
+ set opt = val
+ Set the option opt to the value val. Valid options are:
+
+ autosave (integer) If greater than zero, save the session
+ after the specified amount of seconds after some
+ events happens (new or closed tabs, visited a link
+ ...) Defaults to 20.
+ dont-wrap-pre (integer) If nonzero, don't wrap preformatted
+ blocks. Defaults to 0.
+ emojify-link (integer) If nonzero, when the text of a link
+ starts with an emoji followed by a space, use that
+ emoji as line prefix. Defaults to 1.
+ enable-colors (integer) If nonzero, enable colours. Defaults to
+ 0 if NO_COLORS is set, 1 otherwise.
+ fill-column (integer) If greater than zero, lines of text will
+ be formatted in a way that don't exceed the given
+ number of columns. Defaults to 80.
+ hide-pre-blocks
+ (integer) If nonzero, hide by default the body of
+ the preformatted blocks. Defaults to zero.
+ push-button can be used to toggle the visibility
+ per-block.
+ hide-pre-closing-line
+ (integer) If nonzero, hide the closing line of
+ preformatted blocks. Defaults to 0.
+ hide-pre-context
+ (integer) If nonzero, hide the start and end line
+ of the preformatted blocks. If both hide-pre-
+ context and hide-pre-blocks are nonzero,
+ preformatted blocks are irremediably hidden.
+ Defaults to zero.
+ new-tab-url (string) URL for the new tab page. Defaults to
+ about:new.
+ olivetti-mode (integer) If nonzero, enable olivetti-mode
+ Defaults to 1.
+ set-title (integer) If nonzero, set the terminal title to
+ the page title. Defaults to 1.
+ tab-bar-show (integer) If tab-bar-show is -1 hide the tab bar
+ permanently, if 0 show it unconditionally. If
+ it's 1, show the bar only when there is more than
+ one tab. Defaults to 1.
+
+ style name option
+ Change the styling of the element identified by name. Multiple
+ options may be specified within curly braces. Valid style
+ identifiers are:
+ line the area outside the lines in the body
+ of the page.
+ line.compl the completions.
+ line.compl.current the current completion.
+ line.help text in the *Help* buffer.
+ line.text text lines.
+ line.link link lines.
+ line.title1..3 headings
+ line.item item lines.
+ line.quote quotes.
+ line.pre.start the heading of a preformatted block.
+ line.pre the content of a preformatted block.
+ line.pre.end the closing line of a preformatted
+ block.
+ minibuffer the minibuffer.
+ modeline the modeline.
+ tabline the tabline.
+ tabline.tab the non-focused tabs.
+ tabline.current the focused tab.
+
+ Valid options are:
+
+ attr prefix [line [trail]]
+ Sets the text attributes. If only one value is given,
+ line and trail default to that; if two values are given
+ then trail defaults to prefix. Each attribute is a
+ comma-separated list of keywords:
+ normal no attributes.
+ standout best highlighting mode for the terminal.
+ underline underlines the text.
+ reverse reverses background/foreground colors.
+ blink makes the text blinking.
+ dim half bright.
+ bold extra bright or bold.
+
+ Only the style identifiers with the line. prefix accept
+ up to three attributes. The other will only use the
+ first one given.
+
+ bg prefix [line [trail]]
+ Sets the background color. Follows the same behaviour as
+ attr regarding the optional parameters. The colour is
+ one of black, red, green, yellow, blue, magenta, cyan and
+ white; colour0 to colour255 (or color0 to color255) from
+ the 256-colour set; default for the default colour.
+
+ fg prefix [line [trail]]
+ Sets the foreground color. It behaves just like bg.
+
+ prefix prfx [cont]
+ Sets the prefix for the current line type to prfx and
+ cont as the prefix for the continuation lines (i.e. when
+ a long line gets wrapped.) If cont is not given its value
+ will be the same of prfx.
+
+ENVIRONMENT
+ When telescope is started, it inspects the following environment
+ variables:
+
+ HOME The user's login directory.
+
+ NO_COLORS To decide whether to use colors or not. The content of the
+ variable doesn't matter.
+
+ TERM The user's terminal name.
+
+FILES
+ ~/.telescope/bookmarks.gmi
+ Bookmarks file.
+ ~/.telescope/config
+ Default configuration file.
+ ~/.telescope/known_hosts
+ Hash of the certificates for all the known hosts. Each line
+ contains three fields: hostname with optional port number, hash
+ of the certificate and a numeric flag.
+ ~/.telescope/lock
+ Lock file used to prevent multiple instance of telescope from
+ running at the same time.
+ ~/.telescope/pages/about_*.gmi
+ Overrides for built-in about: pages.
+ ~/.telescope/session
+ The list of tabs from the last session. Every line identifies a
+ tab and contains three space-separated fields: the full URL, a
+ comma-separated list of attributes and the cached title. Is
+ written by kill-telescope and loaded during startup.
+
+EXAMPLES
+ It's possible to browse the small web (i.e. simple websites) by using
+ programs like the duckling-proxy by defining a proxy in
+ ~/.telescope/config:
+
+ proxy http via "gemini://127.0.0.1:1965"
+ proxy https via "gemini://127.0.0.1:1965"
+
+ To load telescope without any configuration
+
+ telescope -c /dev/null
+
+AUTHORS
+ The telescope program was written by Omar Polo <op@omarpolo.com>.
+
+BUGS
+ There's no UI for out-of-band certificates validation.
+
+OpenBSD 7.0 August 27, 2021 OpenBSD 7.0
diff --git a/telescope.1 b/telescope.1
index 5b00535..d4b7fac 100644
--- a/telescope.1
+++ b/telescope.1
@@ -315,7 +315,7 @@ Change the styling of the element identified by
.Ar name .
Multiple options may be specified within curly braces.
Valid style identifiers are:
-.Bl -tag -width line.compl.current -compact -offset Ds
+.Bl -tag -width line.download.ongoing -compact -offset Ds
.It line
the area outside the lines in the body of the page.
.It line.compl
@@ -324,6 +324,12 @@ the completions.
the current completion.
.It line.help
text in the *Help* buffer.
+.It line.download.ongoing
+an ongoing download
+.It line.download.done
+a completed download
+.It line.download.info
+informational text in the *Downloads* buffer.
.It line.text
text lines.
.It line.link
@@ -340,6 +346,8 @@ the heading of a preformatted block.
the content of a preformatted block.
.It line.pre.end
the closing line of a preformatted block.
+.It download
+the download pane
.It minibuffer
the minibuffer.
.It modeline
@@ -900,7 +908,7 @@ can further alter the location of these files.
.Bl -tag -width Ds -compact
.It Pa ~/.config/telescope/config
Default configuration file.
-.It Pa ~/.config/telescope/pages/about_*.gmi
+.It Pa ~/.local/share/telescope/pages/about_*.gmi
Overrides for built-in about: pages.
.It Pa ~/.local/share/telescope/bookmarks.gmi
Bookmarks file.
@@ -949,5 +957,11 @@ The
.Nm
program was written by
.An Omar Polo Aq Mt op@omarpolo.com .
+.Sh CAVEATS
+.Nm
+assumes a UTF-8 environment and doesn't do anything to cope with other
+encodings.
+This can cause weird rendering issues if you're lucky, or possibly
+worst things depending on your locale and terminal emulator.
.Sh BUGS
There's no UI for out-of-band certificates validation.
diff --git a/telescope.c b/telescope.c
index 31a0775..c9076fc 100644
--- a/telescope.c
+++ b/telescope.c
@@ -374,6 +374,7 @@ static void
handle_imsg_got_meta(struct imsg *imsg, size_t datalen)
{
struct tab *tab;
+ char buf[128];
if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL)
return;
@@ -391,12 +392,17 @@ handle_imsg_got_meta(struct imsg *imsg, size_t datalen)
} else if (tab->code == 20) {
if (setup_parser_for(tab)) {
ui_send_net(IMSG_PROCEED, tab->id, NULL, 0);
- } else {
+ } else if (safe_mode) {
load_page_from_str(tab,
err_pages[UNKNOWN_TYPE_OR_CSET]);
- if (!safe_mode)
- ui_yornp("Can't display page, save it?",
- handle_maybe_save_page, tab);
+ } else {
+ struct hist *h;
+
+ if ((h = hist_pop(&tab->hist)) != NULL)
+ tab->hist_cur = h;
+ snprintf(buf, sizeof(buf),
+ "Can't display \"%s\", save it?", tab->meta);
+ ui_yornp(buf, handle_maybe_save_page, tab);
}
} else if (tab->code < 40) { /* 3x */
tab->redirect_count++;
@@ -418,6 +424,9 @@ handle_maybe_save_page(int dosave, struct tab *tab)
const char *f;
char input[PATH_MAX];
+ /* XXX: this print a message that is confusing */
+ ui_on_tab_loaded(tab);
+
if (!dosave) {
stop_tab(tab);
return;
@@ -442,104 +451,83 @@ handle_save_page_path(const char *path, struct tab *tab)
return;
}
- tab->path = strdup(path);
+ ui_show_downloads_pane();
+ enqueue_download(tab->id, path);
ui_send_fs(IMSG_FILE_OPEN, tab->id, path, strlen(path)+1);
+
+ /*
+ * Change this tab id, the old one is associated with the
+ * download now.
+ */
+ tab->id = tab_new_id();
}
static void
handle_imsg_file_opened(struct imsg *imsg, size_t datalen)
{
- struct tab *tab;
- char *page;
+ struct download *d;
const char *e;
- int l;
- if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL) {
- if (imsg->fd != -1)
- close(imsg->fd);
- return;
- }
+ /*
+ * There are no reason we shouldn't be able to find the
+ * required download.
+ */
+ if ((d = download_by_id(imsg->hdr.peerid)) == NULL)
+ die();
if (imsg->fd == -1) {
- stop_tab(tab);
-
e = imsg->data;
if (e[datalen-1] != '\0')
die();
- l = asprintf(&page, "# Can't open file\n\n> %s: %s\n",
- tab->path, e);
- if (l == -1)
- die();
- load_page_from_str(tab, page);
- free(page);
+ message("Can't open file %s: %s", d->path, e);
} else {
- tab->fd = imsg->fd;
- ui_send_net(IMSG_PROCEED, tab->id, NULL, 0);
+ d->fd = imsg->fd;
+ ui_send_net(IMSG_PROCEED, d->id, NULL, 0);
}
}
static void
handle_imsg_buf(struct imsg *imsg, size_t datalen)
{
- struct tab *tab;
- int l;
- char *page, buf[FMT_SCALED_STRSIZE] = {0};
+ struct tab *tab = NULL;
+ struct download *d = NULL;
- if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL)
+ if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL &&
+ (d = download_by_id(imsg->hdr.peerid)) == NULL)
return;
- tab->bytes += datalen;
- if (tab->fd == -1) {
+ if (tab != NULL) {
if (!parser_parse(tab, imsg->data, datalen))
die();
+ ui_on_tab_refresh(tab);
} else {
- write(tab->fd, imsg->data, datalen);
- fmt_scaled(tab->bytes, buf);
- l = asprintf(&page, "Saving to \"%s\"... (%s)\n",
- tab->path,
- buf);
- if (l == -1)
- die();
- load_page_from_str(tab, page);
- free(page);
+ d->bytes += datalen;
+ write(d->fd, imsg->data, datalen);
+ ui_on_download_refresh();
}
-
- ui_on_tab_refresh(tab);
}
static void
handle_imsg_eof(struct imsg *imsg, size_t datalen)
{
- struct tab *tab;
- int l;
- char *page, buf[FMT_SCALED_STRSIZE] = {0};
+ struct tab *tab = NULL;
+ struct download *d = NULL;
- if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL)
+ if ((tab = tab_by_id(imsg->hdr.peerid)) == NULL &&
+ (d = download_by_id(imsg->hdr.peerid)) == NULL)
return;
- if (tab->fd == -1) {
+ if (tab != NULL) {
if (!parser_free(tab))
die();
+ ui_on_tab_refresh(tab);
+ ui_on_tab_loaded(tab);
} else {
- fmt_scaled(tab->bytes, buf);
- l = asprintf(&page, "Saved to \"%s\" (%s)\n",
- tab->path,
- buf);
- if (l == -1)
- die();
- load_page_from_str(tab, page);
- free(page);
-
- close(tab->fd);
- tab->fd = -1;
- tab->bytes = 0;
- free(tab->path);
- tab->path = NULL;
+ close(d->fd);
+ d->fd = -1;
+ ui_on_download_refresh();
}
-
- ui_on_tab_refresh(tab);
- ui_on_tab_loaded(tab);
}
static void
@@ -650,7 +638,7 @@ load_gemini_url(struct tab *tab, const char *url)
memset(&req, 0, sizeof(req));
strlcpy(req.host, tab->uri.host, sizeof(req.host));
- strlcpy(req.port, tab->uri.port, sizeof(req.host));
+ strlcpy(req.port, tab->uri.port, sizeof(req.port));
return make_request(tab, &req, PROTO_GEMINI, tab->hist_cur->h);
}
@@ -693,7 +681,7 @@ load_gopher_url(struct tab *tab, const char *url)
memset(&req, 0, sizeof(req));
strlcpy(req.host, tab->uri.host, sizeof(req.host));
- strlcpy(req.port, tab->uri.port, sizeof(req.host));
+ strlcpy(req.port, tab->uri.port, sizeof(req.port));
path = gopher_skip_selector(tab->uri.path, &type);
switch (type) {
@@ -727,7 +715,7 @@ load_via_proxy(struct tab *tab, const char *url, struct proxy *p)
memset(&req, 0, sizeof(req));
strlcpy(req.host, p->host, sizeof(req.host));
- strlcpy(req.port, p->port, sizeof(req.host));
+ strlcpy(req.port, p->port, sizeof(req.port));
tab->proxy = p;
@@ -779,7 +767,7 @@ gopher_send_search_req(struct tab *tab, const char *text)
memset(&req, 0, sizeof(req));
strlcpy(req.host, tab->uri.host, sizeof(req.host));
- strlcpy(req.port, tab->uri.port, sizeof(req.host));
+ strlcpy(req.port, tab->uri.port, sizeof(req.port));
/* +2 to skip /7 */
strlcpy(req.req, tab->uri.path+2, sizeof(req.req));
@@ -802,8 +790,7 @@ gopher_send_search_req(struct tab *tab, const char *text)
* Effectively load the given url in the given tab. Return 1 when
* loading the page asynchronously, and thus when an erase_buffer can
* be done right after this function return, or 0 when loading the
- * page synchronously. In this last case, erase_buffer *MUST* be
- * called by the handling function (such as load_page_from_str).
+ * page synchronously.
*/
static int
do_load_url(struct tab *tab, const char *url, const char *base)
@@ -815,13 +802,6 @@ do_load_url(struct tab *tab, const char *url, const char *base)
tab->proxy = NULL;
- if (tab->fd != -1) {
- close(tab->fd);
- tab->fd = -1;
- free(tab->path);
- tab->path = NULL;
- }
-
tab->trust = TS_UNKNOWN;
if (base == NULL)
@@ -902,8 +882,8 @@ load_url(struct tab *tab, const char *url, const char *base, int nohist)
sizeof(tab->hist_cur->h));
}
- if (!lazy && do_load_url(tab, url, base))
- erase_buffer(&tab->buffer);
+ if (!lazy)
+ do_load_url(tab, url, base);
}
void
diff --git a/telescope.h b/telescope.h
index d43af08..a65d8fc 100644
--- a/telescope.h
+++ b/telescope.h
@@ -17,17 +17,21 @@
#ifndef TELESCOPE_H
#define TELESCOPE_H
-#include "cmd.h"
#include "compat.h"
-#include "phos/phos.h"
#include <limits.h>
+#include "cmd.h"
+#include "phos/phos.h"
+
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define GEMINI_URL_LEN 1024
+#define SIDE_WINDOW_LEFT 0x1
+#define SIDE_WINDOW_BOTTOM 0x2
+
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);
@@ -94,6 +98,11 @@ enum line_type {
/* help */
LINE_HELP,
+
+ /* download */
+ LINE_DOWNLOAD,
+ LINE_DOWNLOAD_DONE,
+ LINE_DOWNLOAD_INFO,
};
/* for lines: mark as hidden */
@@ -220,10 +229,6 @@ struct tab {
short loading_anim;
short loading_anim_step;
struct event loadingev;
-
- int fd;
- size_t bytes;
- char *path;
};
extern TAILQ_HEAD(proxylist, proxy) proxies;
@@ -251,23 +256,6 @@ struct get_req {
char req[1027];
};
-struct kmap {
- TAILQ_HEAD(map, keymap) m;
- void (*unhandled_input)(void);
-};
-extern struct kmap global_map, minibuffer_map;
-
-typedef void(interactivefn)(struct buffer *);
-
-struct keymap {
- int meta;
- int key;
- struct kmap map;
- interactivefn *fn;
-
- TAILQ_ENTRY(keymap) keymaps;
-};
-
struct cmd {
const char *cmd;
void (*fn)(struct buffer *);
@@ -284,17 +272,27 @@ int config_setcolor(int, const char *, int, int, int);
int config_setattr(const char *, int, int, int);
void config_apply_style(void);
+/* downloads.c */
+extern STAILQ_HEAD(downloads, download) downloads;
+struct download {
+ uint32_t id;
+ int fd;
+ size_t bytes;
+ char *path;
+ STAILQ_ENTRY(download) entries;
+};
+
+void recompute_downloads(void);
+void enqueue_download(uint32_t, const char *);
+struct download *download_by_id(uint32_t);
+
/* help.c */
void recompute_help(void);
/* hist.c */
void hist_clear_forward(struct histhead*, struct hist*);
void hist_push(struct histhead*, struct hist*);
-
-/* keymap.c */
-int kbd(const char*);
-const char *unkbd(int);
-int kmap_define_key(struct kmap*, const char*, void(*)(struct buffer*));
+struct hist *hist_pop(struct histhead *);
/* mime.c */
int setup_parser_for(struct tab*);
diff --git a/ui.c b/ui.c
index a622e68..d3daf66 100644
--- a/ui.c
+++ b/ui.c
@@ -61,6 +61,7 @@ static void line_prefix_and_text(struct vline *, char *, size_t, const char **
static void print_vline(int, int, WINDOW*, struct vline*);
static void redraw_tabline(void);
static void redraw_window(WINDOW*, int, int, int, struct buffer*);
+static void redraw_download(void);
static void redraw_help(void);
static void redraw_body(struct tab*);
static void redraw_modeline(struct tab*);
@@ -93,6 +94,12 @@ static WINDOW *help;
struct buffer helpwin;
int help_lines, help_cols;
+static WINDOW *download;
+/* not static so we can see them from download.c */
+struct buffer downloadwin;
+int download_lines;
+int download_cols;
+
static int side_window;
static int in_side_window;
@@ -152,7 +159,9 @@ restore_curs_x(struct buffer *buffer)
} else
buffer->curs_x = utf8_snwidth(vl->line, buffer->cpoff);
- buffer->curs_x += x_offset;
+ /* small hack: don't olivetti-mode the download pane */
+ if (buffer != &downloadwin)
+ buffer->curs_x += x_offset;
if (vl == NULL)
return;
@@ -177,8 +186,10 @@ current_buffer(void)
{
if (in_minibuffer)
return &ministate.buffer;
- if (in_side_window)
+ if (in_side_window & SIDE_WINDOW_LEFT)
return &helpwin;
+ if (in_side_window & SIDE_WINDOW_BOTTOM)
+ return &downloadwin;
return &current_tab->buffer;
}
@@ -219,7 +230,7 @@ readkey(void)
static void
dispatch_stdio(int fd, short ev, void *d)
{
- struct keymap *k;
+ int lk;
const char *keyname;
char tmp[5] = {0};
@@ -244,30 +255,19 @@ dispatch_stdio(int fd, short ev, void *d)
strlcat(keybuf, tmp, sizeof(keybuf));
}
- TAILQ_FOREACH(k, &current_map->m, keymaps) {
- if (k->meta == thiskey.meta &&
- k->key == thiskey.key) {
- if (k->fn == NULL)
- current_map = &k->map;
- else {
- current_map = base_map;
- strlcpy(keybuf, "", sizeof(keybuf));
- k->fn(current_buffer());
- }
- goto done;
- }
+ lk = lookup_key(&current_map, &thiskey, current_buffer());
+ if (lk == LK_UNBOUND) {
+ if (current_map->unhandled_input != NULL)
+ current_map->unhandled_input();
+ else
+ global_key_unbound();
+ }
+ if (lk != LK_ADVANCED_MAP) {
+ current_map = base_map;
+ strlcpy(keybuf, "", sizeof(keybuf));
}
- if (current_map->unhandled_input != NULL)
- current_map->unhandled_input();
- else
- global_key_unbound();
-
- strlcpy(keybuf, "", sizeof(keybuf));
- current_map = base_map;
-
-done:
- if (side_window)
+ if (side_window & SIDE_WINDOW_LEFT)
recompute_help();
if (should_rearrange_windows)
@@ -310,12 +310,14 @@ static void
rearrange_windows(void)
{
int lines;
+ int minibuffer_lines;
should_rearrange_windows = 0;
show_tab_bar = should_show_tab_bar();
lines = LINES;
+ /* 3 lines for the ui and 12 for the */
if ((too_small = lines < 15)) {
erase();
printw("Window too small.");
@@ -326,9 +328,10 @@ rearrange_windows(void)
/* move and resize the windows, in reverse order! */
if (in_minibuffer == MB_COMPREAD) {
- mvwin(minibuffer, lines-10, 0);
- wresize(minibuffer, 10, COLS);
- lines -= 10;
+ minibuffer_lines = MIN(10, lines/2);
+ mvwin(minibuffer, lines - minibuffer_lines, 0);
+ wresize(minibuffer, minibuffer_lines, COLS);
+ lines -= minibuffer_lines;
wrap_page(&ministate.compl.buffer, COLS);
}
@@ -339,6 +342,16 @@ rearrange_windows(void)
mvwin(modeline, --lines, 0);
wresize(modeline, 1, COLS);
+ if (side_window & SIDE_WINDOW_BOTTOM) {
+ download_lines = MIN(5, lines/2);
+ download_cols = COLS;
+ mvwin(download, lines - download_lines, 0);
+ wresize(download, download_lines, download_cols);
+ lines -= download_lines;
+
+ wrap_page(&downloadwin, download_cols);
+ }
+
body_lines = show_tab_bar ? --lines : lines;
body_cols = COLS;
@@ -346,7 +359,7 @@ rearrange_windows(void)
* Here we make the assumption that show_tab_bar is either 0
* or 1, and reuse that as argument to mvwin.
*/
- if (side_window) {
+ if (side_window & SIDE_WINDOW_LEFT) {
help_cols = 0.3 * COLS;
help_lines = lines;
mvwin(help, show_tab_bar, 0);
@@ -413,10 +426,21 @@ print_vline_descr(int width, WINDOW *window, struct vline *vl)
{
int x, y, goal;
- if (vl->parent->type != LINE_COMPL &&
- vl->parent->type != LINE_COMPL_CURRENT &&
- vl->parent->type != LINE_HELP)
+ switch (vl->parent->type) {
+ case LINE_COMPL:
+ case LINE_COMPL_CURRENT:
+ goal = width/2;
+ break;
+ case LINE_DOWNLOAD:
+ case LINE_DOWNLOAD_DONE:
+ goal = width/4;
+ break;
+ case LINE_HELP:
+ goal = 8;
+ break;
+ default:
return;
+ }
if (vl->parent->alt == NULL)
return;
@@ -424,11 +448,6 @@ print_vline_descr(int width, WINDOW *window, struct vline *vl)
(void)y;
getyx(window, y, x);
- if (vl->parent->type == LINE_HELP)
- goal = 8;
- else
- goal = width/2;
-
if (goal <= x)
wprintw(window, " ");
for (; goal > x; ++x)
@@ -692,6 +711,12 @@ end:
}
static void
+redraw_download(void)
+{
+ redraw_window(download, 0, download_lines, COLS, &downloadwin);
+}
+
+static void
redraw_help(void)
{
redraw_window(help, 0, help_lines, help_cols, &helpwin);
@@ -870,17 +895,29 @@ place_cursor(int soft)
touch = wrefresh;
if (in_minibuffer) {
- if (side_window)
+ if (side_window & SIDE_WINDOW_LEFT)
touch(help);
+ if (side_window & SIDE_WINDOW_BOTTOM)
+ touch(download);
touch(body);
touch(echoarea);
- } else if (in_side_window) {
+ } else if (in_side_window & SIDE_WINDOW_LEFT) {
touch(body);
touch(echoarea);
+ if (in_side_window & SIDE_WINDOW_BOTTOM)
+ touch(download);
touch(help);
+ } else if (in_side_window & SIDE_WINDOW_BOTTOM) {
+ touch(body);
+ touch(echoarea);
+ if (in_side_window & SIDE_WINDOW_LEFT)
+ touch(help);
+ touch(download);
} else {
- if (side_window)
+ if (side_window & SIDE_WINDOW_LEFT)
touch(help);
+ if (side_window & SIDE_WINDOW_BOTTOM)
+ touch(download);
touch(echoarea);
touch(body);
}
@@ -892,11 +929,16 @@ redraw_tab(struct tab *tab)
if (too_small)
return;
- if (side_window) {
+ if (side_window & SIDE_WINDOW_LEFT) {
redraw_help();
wnoutrefresh(help);
}
+ if (side_window & SIDE_WINDOW_BOTTOM) {
+ redraw_download();
+ wnoutrefresh(download);
+ }
+
if (show_tab_bar)
redraw_tabline();
@@ -1021,6 +1063,10 @@ ui_init()
minibuffer_init();
+ /* initialize download window */
+ TAILQ_INIT(&downloadwin.head);
+ TAILQ_INIT(&downloadwin.page.head);
+
/* initialize help window */
TAILQ_INIT(&helpwin.head);
TAILQ_INIT(&helpwin.page.head);
@@ -1055,10 +1101,13 @@ ui_init()
return 0;
if ((minibuffer = newwin(1, 1, 0, 0)) == NULL)
return 0;
+ if ((download = newwin(1, 1, 0, 0)) == NULL)
+ return 0;
if ((help = newwin(1, 1, 0, 0)) == NULL)
return 0;
wbkgd(body, body_face.body);
+ wbkgd(download, download_face.background);
wbkgd(echoarea, minibuffer_face.background);
update_x_offset();
@@ -1115,6 +1164,15 @@ ui_on_tab_refresh(struct tab *tab)
tab->flags |= TAB_URGENT;
}
+void
+ui_on_download_refresh(void)
+{
+ if (side_window & SIDE_WINDOW_BOTTOM) {
+ recompute_downloads();
+ redraw_tab(current_tab);
+ }
+}
+
const char *
ui_keyname(int k)
{
@@ -1122,13 +1180,16 @@ ui_keyname(int k)
}
void
-ui_toggle_side_window(void)
+ui_toggle_side_window(int kind)
{
- side_window = !side_window;
- if (side_window)
+ if (in_side_window & kind)
+ ui_other_window();
+
+ side_window ^= kind;
+ if (side_window & SIDE_WINDOW_LEFT)
recompute_help();
- else
- in_side_window = 0;
+ if (side_window & SIDE_WINDOW_BOTTOM)
+ recompute_downloads();
/*
* ugly hack, but otherwise the window doesn't get updated
@@ -1141,6 +1202,13 @@ ui_toggle_side_window(void)
}
void
+ui_show_downloads_pane(void)
+{
+ if (!(side_window & SIDE_WINDOW_BOTTOM))
+ ui_toggle_side_window(SIDE_WINDOW_BOTTOM);
+}
+
+void
ui_schedule_redraw(void)
{
should_rearrange_windows = 1;
@@ -1200,8 +1268,15 @@ ui_read(const char *prompt, void (*fn)(const char*, struct tab *),
void
ui_other_window(void)
{
- if (side_window)
- in_side_window = !in_side_window;
+ if (in_side_window & SIDE_WINDOW_LEFT &&
+ side_window & SIDE_WINDOW_BOTTOM)
+ in_side_window = SIDE_WINDOW_BOTTOM;
+ else if (in_side_window)
+ in_side_window = 0;
+ else if (!in_side_window && side_window & SIDE_WINDOW_LEFT)
+ in_side_window = SIDE_WINDOW_LEFT;
+ else if (!in_side_window && side_window)
+ in_side_window = SIDE_WINDOW_BOTTOM;
else
message("No other window to select");
}
diff --git a/ui.h b/ui.h
index 5b6289b..91f25e7 100644
--- a/ui.h
+++ b/ui.h
@@ -17,6 +17,7 @@
#ifndef UI_H
#define UI_H
+#include "keymap.h"
#include "telescope.h"
extern int body_lines;
@@ -100,16 +101,25 @@ enum pairs {
PHELP,
PHELP_TRAIL,
+ PDOWNLOAD_PRFX,
+ PDOWNLOAD,
+ PDOWNLOAD_TRAIL,
+
+ PDOWNLOAD_DONE_PRFX,
+ PDOWNLOAD_DONE,
+ PDOWNLOAD_DONE_TRAIL,
+
+ PDOWNLOAD_INFO_PRFX,
+ PDOWNLOAD_INFO,
+ PDOWNLOAD_INFO_TRAIL,
+
+ PDOWNLOAD_WIN,
+
PMODELINE,
PMINIBUF,
};
-struct thiskey {
- short meta;
- int key;
- uint32_t cp;
-};
extern struct thiskey thiskey;
extern struct tab *current_tab;
@@ -117,6 +127,10 @@ extern struct tab *current_tab;
extern struct buffer helpwin;
extern int help_lines, help_cols;
+extern struct buffer downloadwin;
+extern int download_lines;
+extern int download_cols;
+
void save_excursion(struct excursion *, struct buffer *);
void restore_excursion(struct excursion *, struct buffer *);
void global_key_unbound(void);
@@ -129,8 +143,10 @@ int ui_init(void);
void ui_main_loop(void);
void ui_on_tab_loaded(struct tab *);
void ui_on_tab_refresh(struct tab *);
+void ui_on_download_refresh(void);
const char *ui_keyname(int);
-void ui_toggle_side_window(void);
+void ui_toggle_side_window(int);
+void ui_show_downloads_pane(void);
void ui_schedule_redraw(void);
void ui_after_message_hook(void);
void ui_require_input(struct tab *, int, int);
diff --git a/wrap.c b/wrap.c
index 6fd7a38..7cf9b8a 100644
--- a/wrap.c
+++ b/wrap.c
@@ -278,6 +278,9 @@ wrap_page(struct buffer *buffer, int width)
case LINE_COMPL:
case LINE_COMPL_CURRENT:
case LINE_HELP:
+ case LINE_DOWNLOAD:
+ case LINE_DOWNLOAD_DONE:
+ case LINE_DOWNLOAD_INFO:
wrap_one(buffer, prfx, l, width);
break;
}