From 657c45abb7abfd918db15a672e073d926f394cb5 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Mon, 19 Oct 2020 16:51:47 -0400 Subject: [PATCH 1/2] Clear selection on copy if smart_copy is configured --- terminatorlib/terminal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index c3d52ac8..def0bee7 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1757,7 +1757,7 @@ class Terminal(Gtk.VBox): if rv: alloc.x, alloc.y = rv return alloc - + # There now begins a great list of keyboard event handlers def key_zoom_in(self): self.zoom_in() @@ -1773,6 +1773,8 @@ class Terminal(Gtk.VBox): def key_copy(self): self.vte.copy_clipboard() + if self.config['smart_copy']: + self.vte.unselect_all() def key_paste(self): self.paste_clipboard() From 1822d6ccb1077663b8fdfb5eda52d6fcbbd7c279 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Mon, 19 Oct 2020 17:14:40 -0400 Subject: [PATCH 2/2] add config entry and preferences GUI --- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 44 ++++++++++++++++++++++++++++----- terminatorlib/prefseditor.py | 5 ++++ terminatorlib/terminal.py | 4 +-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 8083791a..ce51a726 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -121,6 +121,7 @@ DEFAULTS = { 'putty_paste_style' : False, 'putty_paste_style_source_clipboard': False, 'smart_copy' : True, + 'clear_select_on_copy' : False, 'line_height' : 1.0, }, 'keybindings': { diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index de9439ee..9a17abf1 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -605,7 +605,7 @@ - 1 + 2 0 2 @@ -638,7 +638,7 @@ - 1 + 2 1 2 @@ -673,7 +673,6 @@ 0 3 - 3 @@ -754,7 +753,7 @@ 0 6 - 3 + 4 @@ -770,7 +769,7 @@ - 1 + 2 2 @@ -788,10 +787,43 @@ - 2 + 3 2 + + + Clear selection on copy + True + True + False + True + + + + 2 + 3 + 2 + + + + + + + + + + + + + + + + + + + + True diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 01a62189..bbb4218c 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -824,6 +824,11 @@ class PrefsEditor: self.config['smart_copy'] = widget.get_active() self.config.save() + def on_clear_select_on_copy_toggled(self,widget): + """Clear selection on smart copy""" + self.config['clear_select_on_copy'] = widget.get_active() + self.config.save() + def on_cursor_blink_toggled(self, widget): """Cursor blink setting changed""" self.config['cursor_blink'] = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index def0bee7..de75852c 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1757,7 +1757,7 @@ class Terminal(Gtk.VBox): if rv: alloc.x, alloc.y = rv return alloc - + # There now begins a great list of keyboard event handlers def key_zoom_in(self): self.zoom_in() @@ -1773,7 +1773,7 @@ class Terminal(Gtk.VBox): def key_copy(self): self.vte.copy_clipboard() - if self.config['smart_copy']: + if self.config['clear_select_on_copy']: self.vte.unselect_all() def key_paste(self):