parent
c763db94ce
commit
242d335095
@ -26,6 +26,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
clicks to the application unless :opt:`terminal_select_modifiers` are
|
||||
pressed (:iss:`2368`)
|
||||
|
||||
- A new ``copy_and_clear_or_interrupt`` function (:iss:`2403`)
|
||||
|
||||
- X11: Fix arrow mouse cursor using right pointing instead of the default left
|
||||
pointing arrow (:iss:`2341`)
|
||||
|
||||
|
||||
@ -1159,7 +1159,8 @@ to zero for all mappings, including the builtin ones.
|
||||
g('shortcuts.clipboard') # {{{
|
||||
k('copy_to_clipboard', 'kitty_mod+c', 'copy_to_clipboard', _('Copy to clipboard'), long_text=_('''
|
||||
There is also a :code:`copy_or_interrupt` action that can be optionally mapped to :kbd:`Ctrl+c`.
|
||||
It will copy only if there is a selection and send an interrupt otherwise.'''))
|
||||
It will copy only if there is a selection and send an interrupt otherwise. Similarly, :code:`copy_and_clear_or_interrupt`
|
||||
will copy and clear the selection or send an interrupt if there is no selection.'''))
|
||||
if is_macos:
|
||||
k('copy_to_clipboard', 'cmd+c', 'copy_to_clipboard', _('Copy to clipboard'), add_to_docs=False)
|
||||
k('paste_from_clipboard', 'kitty_mod+v', 'paste_from_clipboard', _('Paste from clipboard'))
|
||||
|
||||
@ -2048,6 +2048,12 @@ update_selection(Screen *self, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
clear_selection(Screen *self, PyObject *args UNUSED) {
|
||||
self->selection = EMPTY_SELECTION;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
WRAP0x(index)
|
||||
WRAP0(reverse_index)
|
||||
WRAP0(reset)
|
||||
@ -2475,6 +2481,7 @@ static PyMethodDef methods[] = {
|
||||
MND(clear_tab_stop, METH_VARARGS)
|
||||
MND(start_selection, METH_VARARGS)
|
||||
MND(update_selection, METH_VARARGS)
|
||||
MND(clear_selection, METH_NOARGS)
|
||||
MND(reverse_index, METH_NOARGS)
|
||||
MND(mark_as_dirty, METH_NOARGS)
|
||||
MND(resize, METH_VARARGS)
|
||||
|
||||
@ -588,6 +588,10 @@ class Window:
|
||||
text = extended_key_event(defines.GLFW_KEY_C, defines.GLFW_MOD_CONTROL, defines.GLFW_PRESS) if mode == 'kitty' else b'\x03'
|
||||
self.write_to_child(text)
|
||||
|
||||
def copy_and_clear_or_interrupt(self):
|
||||
self.copy_or_interrupt()
|
||||
self.screen.clear_selection()
|
||||
|
||||
def pass_selection_to_program(self, *args):
|
||||
cwd = self.cwd_of_child
|
||||
text = self.text_for_selection()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user