Also add a changelog entry and some stylistic fixes
This commit is contained in:
Kovid Goyal 2020-11-22 12:31:28 +05:30
commit d13ad4ec4b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Wayland: Fix key repeat being stopped by the release of an unrelated key
(:iss:`2191`)
- Add an :opt:`detect_urls` to control whether kitty will detect URLs when the
mouse moves over them (:pull:`3118`)
0.19.2 [2020-11-13]
-------------------

View File

@ -520,6 +520,11 @@ def url_prefixes(x: str) -> Tuple[str, ...]:
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.'''))
o('detect_urls', True, long_text=_('''
Detect URLs under the mouse. Detected URLs are highlighted
with an underline and the mouse cursor becomes a hand over them.
Even if this option is disabled, URLs are still clickable.'''))
def copy_on_select(raw: str) -> str:
q = raw.lower()

View File

@ -368,7 +368,7 @@ HANDLER(handle_move_event) {
bool in_left_half_of_cell = false;
if (!cell_for_pos(w, &x, &y, &in_left_half_of_cell, global_state.callback_os_window)) return;
Screen *screen = w->render_data.screen;
detect_url(screen, x, y);
if(OPT(detect_urls)) detect_url(screen, x, y);
bool mouse_cell_changed = x != w->mouse_pos.cell_x || y != w->mouse_pos.cell_y;
bool cell_half_changed = in_left_half_of_cell != w->mouse_pos.in_left_half_of_cell;
w->mouse_pos.cell_x = x; w->mouse_pos.cell_y = y;

View File

@ -705,6 +705,7 @@ PYWRAP1(set_options) {
S(pointer_shape_when_grabbed, pointer_shape);
S(default_pointer_shape, pointer_shape);
S(pointer_shape_when_dragging, pointer_shape);
S(detect_urls, PyObject_IsTrue);
GA(tab_bar_style);
global_state.tab_bar_hidden = PyUnicode_CompareWithASCIIString(ret, "hidden") == 0 ? true: false;

View File

@ -72,6 +72,7 @@ typedef struct {
UrlPrefix *values;
size_t num, max_prefix_len;
} url_prefixes;
bool detect_urls;
} Options;
typedef struct {