rm the comma-separated hint feature
This commit is contained in:
		
							parent
							
								
									329e4ff9c6
								
							
						
					
					
						commit
						c0af43dd53
					
				
							
								
								
									
										14
									
								
								termite.cc
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								termite.cc
									
									
									
									
									
								
							@ -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()) {
 | 
			
		||||
    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", token);
 | 
			
		||||
        }
 | 
			
		||||
        g_printerr("url hint invalid: %s\n", text);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user