Allow clicking URLs to open them without needing to also hold ctrl+shift
This commit is contained in:
parent
85ef3724f1
commit
bcb739fcd2
@ -7,6 +7,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
0.21.0 [future]
|
||||
----------------------
|
||||
|
||||
- Allow clicking URLs to open them without needing to also hold
|
||||
:kbd:`ctrl+shift`
|
||||
|
||||
- Allow remapping all mouse button press/release events to perform arbitrary
|
||||
actions. :ref:`See details <conf-kitty-mouse.mousemap>`.
|
||||
|
||||
|
||||
@ -258,8 +258,7 @@ For example:
|
||||
Mouse features
|
||||
-------------------
|
||||
|
||||
* You can hold down :kbd:`ctrl+shift` and click on a URL to open it in a
|
||||
browser.
|
||||
* You can click on a URL to open it in a browser.
|
||||
* You can double click to select a word and then drag to select more words.
|
||||
* You can triple click to select a line and then drag to select more lines.
|
||||
* You can right click to extend a previous selection.
|
||||
|
||||
@ -665,7 +665,11 @@ Valid values are: :code:`arrow`, :code:`beam` and :code:`hand`
|
||||
|
||||
g('mouse.mousemap') # {{{
|
||||
|
||||
m('click_url', 'ctrl+shift+left', 'release', 'grabbed,ungrabbed', 'mouse_click_url', _('Click the link under the mouse cursor'))
|
||||
m('click_url_or_select', 'left', 'click', 'ungrabbed', 'mouse_click_url_or_select', _('Click the link under the mouse cursor when no selection is created'))
|
||||
m('click_url_or_select_grabbed', 'shift+left', 'click', 'grabbed,ungrabbed', 'mouse_click_url_or_select', _(
|
||||
'Click the link under the mouse cursor when no selection is created even if grabbed'))
|
||||
m('click_url', 'ctrl+shift+left', 'release', 'grabbed,ungrabbed', 'mouse_click_url',
|
||||
_('Click the link under the mouse cursor'), _('Variant with :kbd:`ctrl+shift` is present only for legacy compatibility.'))
|
||||
|
||||
for grabbed in (False, True):
|
||||
modes = 'ungrabbed' + (',grabbed' if grabbed else '')
|
||||
|
||||
@ -977,6 +977,9 @@ class Screen:
|
||||
def reset_callbacks(self) -> None:
|
||||
pass
|
||||
|
||||
def has_selection(self) -> bool:
|
||||
pass
|
||||
|
||||
def text_for_selection(self) -> Tuple[str, ...]:
|
||||
pass
|
||||
|
||||
|
||||
@ -2113,6 +2113,7 @@ deactivate_overlay_line(Screen *self) {
|
||||
#define WRAP2B(name) static PyObject* name(Screen *self, PyObject *args) { unsigned int a, b; int p; if(!PyArg_ParseTuple(args, "IIp", &a, &b, &p)) return NULL; screen_##name(self, a, b, (bool)p); Py_RETURN_NONE; }
|
||||
|
||||
WRAP0(garbage_collect_hyperlink_pool)
|
||||
WRAP0x(has_selection)
|
||||
|
||||
static PyObject*
|
||||
hyperlinks_as_list(Screen *self, PyObject *args UNUSED) {
|
||||
@ -2952,6 +2953,7 @@ static PyMethodDef methods[] = {
|
||||
MND(cursor_down1, METH_VARARGS)
|
||||
MND(cursor_forward, METH_VARARGS)
|
||||
{"index", (PyCFunction)xxx_index, METH_VARARGS, ""},
|
||||
{"has_selection", (PyCFunction)xxx_has_selection, METH_VARARGS, ""},
|
||||
MND(set_pending_timeout, METH_O)
|
||||
MND(as_text, METH_VARARGS)
|
||||
MND(as_text_non_visual, METH_VARARGS)
|
||||
|
||||
@ -801,6 +801,10 @@ class Window:
|
||||
def mouse_click_url(self) -> None:
|
||||
click_mouse_url(self.os_window_id, self.tab_id, self.id)
|
||||
|
||||
def mouse_click_url_or_select(self) -> None:
|
||||
if not self.screen.has_selection():
|
||||
self.mouse_click_url()
|
||||
|
||||
def mouse_selection(self, code: int) -> None:
|
||||
mouse_selection(self.os_window_id, self.tab_id, self.id, code, self.current_mouse_event_button)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user