Dont discard information on whether a click hit a URL
This commit is contained in:
parent
606ce4e66f
commit
bc202aec6e
@ -1189,7 +1189,7 @@ def set_window_padding(os_window_id: int, tab_id: int, window_id: int, left: int
|
||||
pass
|
||||
|
||||
|
||||
def click_mouse_url(os_window_id: int, tab_id: int, window_id: int) -> None:
|
||||
def click_mouse_url(os_window_id: int, tab_id: int, window_id: int) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@ -403,11 +403,11 @@ add_press(Window *w, int button, int modifiers) {
|
||||
}
|
||||
#undef N
|
||||
|
||||
void
|
||||
bool
|
||||
mouse_open_url(Window *w) {
|
||||
Screen *screen = w->render_data.screen;
|
||||
detect_url(screen, w->mouse_pos.cell_x, w->mouse_pos.cell_y);
|
||||
screen_open_url(screen);
|
||||
return screen_open_url(screen);
|
||||
}
|
||||
|
||||
typedef struct PendingClick {
|
||||
|
||||
@ -1020,11 +1020,13 @@ pycreate_mock_window(PyObject *self UNUSED, PyObject *args) {
|
||||
return ans;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
click_mouse_url(id_type os_window_id, id_type tab_id, id_type window_id) {
|
||||
bool clicked = false;
|
||||
WITH_WINDOW(os_window_id, tab_id, window_id);
|
||||
mouse_open_url(window);
|
||||
clicked = mouse_open_url(window);
|
||||
END_WITH_WINDOW;
|
||||
return clicked;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
@ -1038,9 +1040,14 @@ pymouse_selection(PyObject *self UNUSED, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PYWRAP1(click_mouse_url) {
|
||||
id_type a, b, c; PA("KKK", &a, &b, &c);
|
||||
if (click_mouse_url(a, b, c)) { Py_RETURN_TRUE; }
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
THREE_ID_OBJ(update_window_title)
|
||||
THREE_ID(remove_window)
|
||||
THREE_ID(click_mouse_url)
|
||||
THREE_ID(detach_window)
|
||||
THREE_ID(attach_window)
|
||||
PYWRAP1(resolve_key_mods) { int mods, kitty_mod; PA("ii", &kitty_mod, &mods); return PyLong_FromLong(resolve_mods(kitty_mod, mods)); }
|
||||
|
||||
@ -302,7 +302,7 @@ void set_os_window_title_from_window(Window *w, OSWindow *os_window);
|
||||
void update_os_window_title(OSWindow *os_window);
|
||||
void fake_scroll(Window *w, int amount, bool upwards);
|
||||
Window* window_for_window_id(id_type kitty_window_id);
|
||||
void mouse_open_url(Window *w);
|
||||
bool mouse_open_url(Window *w);
|
||||
void mouse_selection(Window *w, int code, int button);
|
||||
const char* format_mods(unsigned mods);
|
||||
void send_pending_click_to_window_id(id_type, void*);
|
||||
|
||||
@ -858,7 +858,8 @@ class Window:
|
||||
@ac('mouse', 'Click the URL under the mouse only if the screen has no selection')
|
||||
def mouse_click_url_or_select(self) -> None:
|
||||
if not self.screen.has_selection():
|
||||
self.mouse_click_url()
|
||||
if not click_mouse_url(self.os_window_id, self.tab_id, self.id):
|
||||
pass # no URL found
|
||||
|
||||
@ac('mouse', '''
|
||||
Manipulate the selection based on the current mouse position
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user