rm the comma-separated hint feature

This commit is contained in:
Daniel Micay 2013-02-20 03:19:04 -05:00
parent 329e4ff9c6
commit c0af43dd53
1 changed files with 7 additions and 15 deletions

View File

@ -164,21 +164,13 @@ static void find_urls(VteTerminal *vte, search_panel_info *panel_info) {
}
static void launch_url(char *browser, const char *text, search_panel_info *info) {
auto copy = make_unique(strdup(text), free);
for (char *s_ptr = copy.get(), *saveptr; ; s_ptr = nullptr) {
const char *token = strtok_r(s_ptr, ",", &saveptr);
if (!token) {
break;
}
char *end;
errno = 0;
unsigned long id = strtoul(token, &end, 10);
if (!errno && id && id <= info->url_list.size()) {
launch_browser(browser, info->url_list[id - 1].url.get());
} else {
g_printerr("url hint invalid: %s\n", token);
}
char *end;
errno = 0;
unsigned long id = strtoul(text, &end, 10);
if (!errno && id && id <= info->url_list.size() && !*end) {
launch_browser(browser, info->url_list[id - 1].url.get());
} else {
g_printerr("url hint invalid: %s\n", text);
}
}