Make the set of URL prefixes that are recognized while hovering with the mouse configurable

Fixes #2416
This commit is contained in:
Kovid Goyal
2020-03-08 13:16:34 +05:30
parent cc1336a616
commit 645890ccc8
7 changed files with 72 additions and 18 deletions

View File

@@ -6,7 +6,7 @@
import os
from gettext import gettext as _
from typing import (
Any, Dict, FrozenSet, Iterable, List, Optional, Set, Tuple, TypeVar, Union
Any, Dict, FrozenSet, Iterable, List, Optional, Set, Tuple, TypeVar, Union, cast
)
from . import fast_data_types as defines
@@ -502,6 +502,14 @@ The special value :code:`default` means to use the
operating system's default URL handler.'''))
def url_prefixes(x: str) -> Tuple[str, ...]:
return tuple(a.lower() for a in x.replace(',', ' ').split())
o('url_prefixes', 'http https file ftp', option_type=url_prefixes, long_text=_('''
The set of URL prefixes to look for when detecting a URL under the mouse cursor.'''))
def copy_on_select(raw: str) -> str:
q = raw.lower()
# boolean values special cased for backwards compat
@@ -784,7 +792,7 @@ separated by a configurable separator, and the powerline shows the tabs as a con
def tab_bar_min_tabs(x: str) -> int:
return max(1, positive_int(x))
return cast(int, max(1, positive_int(x)))
o('tab_bar_min_tabs', 2, option_type=tab_bar_min_tabs, long_text=_('''
@@ -1068,7 +1076,7 @@ def macos_titlebar_color(x: str) -> int:
return 0
if x == 'background':
return 1
return (color_as_int(to_color(x)) << 8) | 2
return cast(int, (color_as_int(to_color(x)) << 8) | 2)
o('macos_titlebar_color', 'system', option_type=macos_titlebar_color, long_text=_('''