~sircmpwn/visurf-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] nsvi: load nsvirc

Details
Message ID
<20210914161532.28677-1-ecs@d2evs.net>
DKIM signature
pass
Download raw message
Patch: +24 -1
---
There's currently nothing useful you can do with this, but you can
verify that this works by sticking "open xkcd.com" in
~/.config/netsurf/nsvirc and noting the error you get from cmd_open
 frontends/visurf/main.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/frontends/visurf/main.c b/frontends/visurf/main.c
index 03feded9e..56faefe21 100644
--- a/frontends/visurf/main.c
+++ b/frontends/visurf/main.c
@@ -738,7 +738,6 @@ nsvi_init_resource(const char *resource_path)
static void
nsvi_init_bindings(struct nsvi_state *state, struct nsvi_bindings *bindings)
{
	// TODO: Load bindings from config
	state->bindings.exec = nsvi_command;
	state->bindings.user = state;
	nsvi_bindings_new(bindings, "<colon>", "exline");
@@ -781,6 +780,28 @@ nsvi_init_bindings(struct nsvi_state *state, struct nsvi_bindings *bindings)
	nsvi_bindings_new(bindings, "<Prior>", "scroll 100%+");
}

static void
nsvi_load_config(struct nsvi_state *state)
{
	assert(config_home != NULL);
	char *config = NULL;
	netsurf_mkpath(&config, NULL, 2, config_home, "nsvirc");
	if (config == NULL) {
		return;
	}
	FILE *f = fopen(config, "r");
	if (f == NULL)  {
		return;
	}
	char *line = NULL;
	size_t len = 0;
	while (getline(&line, &len, f) != -1) {
		nsvi_command(state, line);
	}
	free(line);
	fclose(f);
}

int
main(int argc, char *argv[]) {
	struct nsvi_state state = {0};
@@ -868,6 +889,8 @@ main(int argc, char *argv[]) {
		fatal("browser_window_create failed");
	}

	nsvi_load_config(&state);

	while (!state.quit) {
		if (wl_display_flush(state.wl_display) == -1 && errno != EAGAIN) {
			break;
-- 
2.33.0
Details
Message ID
<CE9QS2Y9DSDZ.3UG9GARHY12NT@taiga>
In-Reply-To
<20210914161532.28677-1-ecs@d2evs.net> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Tue Sep 14, 2021 at 6:15 PM CEST, Eyal Sawady wrote:
> ---
> There's currently nothing useful you can do with this, but you can
> verify that this works by sticking "open xkcd.com" in
> ~/.config/netsurf/nsvirc and noting the error you get from cmd_open
> frontends/visurf/main.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/frontends/visurf/main.c b/frontends/visurf/main.c
> index 03feded9e..56faefe21 100644
> --- a/frontends/visurf/main.c
> +++ b/frontends/visurf/main.c
> @@ -738,7 +738,6 @@ nsvi_init_resource(const char *resource_path)
> static void
> nsvi_init_bindings(struct nsvi_state *state, struct nsvi_bindings
> *bindings)
> {
> - // TODO: Load bindings from config

I don't think this TODO should be removed until we have implemented a
"bind" command (and unbind).

Otherwise this LGTM
Reply to thread Export thread (mbox)