From: Daniel Carl Date: Mon, 27 May 2013 18:20:34 +0000 (+0200) Subject: Allow about:* urls (#20). X-Git-Url: https://git.owens.tech/assets/me.png/assets/me.png/git?a=commitdiff_plain;h=f7d29afe465de683e1104ca880909d035bb9f6c6;p=vimb.git Allow about:* urls (#20). This was added to have an empty start page. So if the setting 'home-page' is set to empty ':set home-page=' there is the home-page set to 'about:blank'. --- diff --git a/src/main.c b/src/main.c index 9dcc98f..b7d4fb7 100644 --- a/src/main.c +++ b/src/main.c @@ -124,19 +124,15 @@ gboolean vb_eval_script(WebKitWebFrame *frame, char *script, char *file, char ** gboolean vb_load_uri(const Arg *arg) { - char *uri = NULL, *rp, *path = arg->s; + char *uri = NULL, *rp, *path = arg->s ? arg->s : ""; struct stat st; - if (!path) { - path = vb.config.home_page; - } - g_strstrip(path); - if (!strlen(path)) { + if (*path == '\0') { path = vb.config.home_page; } - if (g_strrstr(path, "://")) { + if (g_strrstr(path, "://") || !strncmp(path, "about:", 6)) { uri = g_strdup(path); } else if (stat(path, &st) == 0) { /* check if the path is a file path */ diff --git a/src/setting.c b/src/setting.c index bc3be88..86a42c1 100644 --- a/src/setting.c +++ b/src/setting.c @@ -573,7 +573,10 @@ static gboolean home_page(const Setting *s, const SettingType type) if (type == SETTING_GET) { print_value(s, vb.config.home_page); } else { - OVERWRITE_STRING(vb.config.home_page, s->arg.s); + OVERWRITE_STRING( + vb.config.home_page, + *(s->arg.s) == '\0' ? "about:blank" : s->arg.s + ); } return true;