~ofiala

Recent activity

Re: [PATCH gmni] gmnlm: enable pagination of plaintext documents 3 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

Well, the only alternatives are either duplicating code (even worse
imho) or splitting the common pieces of code into few generalized
functions, which seems optimal, but also fairly difficult due to how
the code is currently structured. I invite anyone brave enough to try
it though.

[PATCH gmni] gmnlm: fix memory leak in do_requests 3 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

---
 src/gmnlm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index 0212906..1f06146 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -533,6 +533,7 @@ out:
	if (client_cert.key) {
		free(client_cert.key);
	}
	free(path_fmt);
	free(scheme);
[message trimmed]

[PATCH gmni] gmnlm: enable pagination of plaintext documents 3 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

I initially intended to expand display_plaintext, but it quickly became
apparent that except for few lines I would be duplicating existing code
from display_gemini and gemini_parser_next. However, these few
differing lines made it impossible to reuse as-was.

I solved this by making display_gemini (generalized as display_document)
take the only thing that would differ as an argument and splitting off a
part of gemini_parser_next to make it reusable.

A cleaner solution would require significant refactoring.
---
Please disregard the previous patch, this one includes ANSI escapes
trimming as a side effect of making gemtext & plaintext basically
equivalent.
[message trimmed]

[PATCH gmni v2] gmnlm: strip control sequences from plaintext rendering 3 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

---
Missed an exception for tab. Vertical tab also allowed as it seems
fairly harmless (compared to e.g. carriage return).

 src/gmnlm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index b27cf6a..1d1cbcf 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -1012,7 +1012,6 @@ repeat:
static bool
display_plaintext(struct browser *browser, struct gemini_response *resp)
[message trimmed]

[PATCH gmni] gmnlm: strip control sequences from plaintext rendering 3 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

---
 src/gmnlm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index b27cf6a..91c9a1d 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -1012,7 +1012,6 @@ repeat:
static bool
display_plaintext(struct browser *browser, struct gemini_response *resp)
{
	// TODO: Strip ANSI escape sequences
	struct winsize ws;
[message trimmed]

[PATCH] gmnlm: d <path> -> d [path] 4 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

The argument is optional, the 'd' command works without it.
---
 src/gmnlm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index 3160327..b27cf6a 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -83,7 +83,7 @@ const char *help_msg =
	"m [title]\tSave bookmark\n"
	"M\tBrowse bookmarks\n"
	"r\tReload the page\n"
	"d <path>\tDownload page to <path>\n"
[message trimmed]

[PATCH] fix null dereference 4 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

---
My previous patch failed to include null check on browser->page_title,
causing null dereference when title is not set. Oops.

 src/gmnlm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index f5b7480..3160327 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -614,7 +614,7 @@ do_prompts(const char *prompt, struct browser *browser)
	case 'm':
		if (in[1] != '\0' && !isspace(in[1])) break;
[message trimmed]

[PATCH] gmnlm: add optional custom bookmark titles 4 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

It is often useful to title a bookmark differently from how the page's
author titled it.
---
 src/gmnlm.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index 536914a..f5b7480 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -80,7 +80,7 @@ const char *help_msg =
	"b[N]\tJump back N entries in history, N is optional, default 1\n"
	"f[N]\tJump forward N entries in history, N is optional, default 1\n"
	"H\tView all page history\n"
[message trimmed]

[PATCH v2] gmnlm: output newline when quiting via Control-D 4 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

It is common practice to quit programs reading from stdin by sending
EOF to their input. This commit ensures such an exit is functionally
equivalent to a regular exit via the 'q' command.
---
Apologies, forgot to properly verify it works. This should do.

 src/gmnlm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index b30d602..536914a 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -553,6 +553,7 @@ do_prompts(const char *prompt, struct browser *browser)
[message trimmed]

[PATCH] gmnlm: output newline when quiting via Control-D 4 months ago

From Ondřej Fiala to ~sircmpwn/gmni-devel

It is common practice to quit programs reading from stdin by sending
EOF to their input. This commit ensures such an exit is functionally
equivalent to a regular exit via the 'q' command.
---
When quiting via Control-D rather than the 'q' command, the shell prompt
gets mixed with the gmnlm one.

 src/gmnlm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index b30d602..6b0016c 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
[message trimmed]