From 8d27c58daea090eb2951ed555169ecf4518a59f7 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Tue, 22 Dec 2020 21:15:12 -0500 Subject: [PATCH 1/8] add note aboug moving config file out of the way --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ff35415f..1d682594 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,11 @@ assignees: '' --- -Please fill out as many of these fields as you can +Please try moving the terminator config out of the way to see if that solves the +problem. If it does, and you still want to open the bug, then please attach the +config file to the issue + +Fill out as many of these fields as you can **Describe the bug** A clear and concise description of what the bug is. From e43369d3e6857a19ef1aadb3cc6c5c5230a9611c Mon Sep 17 00:00:00 2001 From: David Sowder Date: Sun, 27 Dec 2020 09:06:00 -0600 Subject: [PATCH 2/8] Re-factor Titlebar.update() to not duplicate the label text setting call --- terminatorlib/titlebar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index d6cd557a..8df29f3b 100644 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -104,10 +104,11 @@ class Titlebar(Gtk.EventBox): def update(self, other=None): """Update our contents""" default_bg = False - if self.config['title_hide_sizetext']: - self.label.set_text("%s" % self.termtext) - else: - self.label.set_text("%s %s" % (self.termtext, self.sizetext)) + + temp_sizetext_str = '' + if not self.config['title_hide_sizetext']: + temp_sizetext_str = " %s" % (self.sizetext) + self.label.set_text("%s%s" % (self.termtext, temp_sizetext_str)) if (not self.config['title_use_system_font']) and self.config['title_font']: title_font = Pango.FontDescription(self.config['title_font']) From 5c7233890f2e34d699fb740a422b9431f8e7fe66 Mon Sep 17 00:00:00 2001 From: David Sowder Date: Sun, 27 Dec 2020 10:12:19 -0600 Subject: [PATCH 3/8] Add feature to allow relaunching the command after child exit when the exit action is to hold the tab open --- terminatorlib/terminal.py | 15 +++++++++++++++ terminatorlib/terminal_popup_menu.py | 6 ++++++ terminatorlib/titlebar.py | 6 +++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index d25fbc9b..a11b734f 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -126,8 +126,11 @@ class Terminal(Gtk.VBox): custom_encoding = None custom_font_size = None layout_command = None + relaunch_command = None directory = None + is_held_open = False + fgcolor_active = None bgcolor = None palette_active = None @@ -676,6 +679,8 @@ class Terminal(Gtk.VBox): if self.config['exit_action'] == 'restart': self.cnxids.new(self.vte, 'child-exited', self.spawn_child, True) + elif self.config['exit_action'] == 'hold': + self.cnxids.new(self.vte, 'child-exited', self.held_open, True) elif self.config['exit_action'] in ('close', 'left'): self.cnxids.new(self.vte, 'child-exited', lambda x, y: self.emit('close-term')) @@ -1429,6 +1434,10 @@ class Terminal(Gtk.VBox): if cwd is not None: self.cwd = cwd + def held_open(self, widget=None, respawn=False, debugserver=False): + self.is_held_open = True + self.titlebar.update() + def spawn_child(self, widget=None, respawn=False, debugserver=False): args = [] shell = None @@ -1441,13 +1450,19 @@ class Terminal(Gtk.VBox): if respawn == False: self.vte.grab_focus() + self.is_held_open = False + options = self.config.options_get() if options and options.command: command = options.command + self.relaunch_command = command options.command = None elif options and options.execute: command = options.execute + self.relaunch_command = command options.execute = None + elif self.relaunch_command: + command = self.relaunch_command elif self.config['use_custom_command']: command = self.config['custom_command'] elif self.layout_command: diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index 29ca7751..8af5be62 100644 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -179,6 +179,12 @@ class TerminalPopupMenu(object): menu.append(item) menu.append(Gtk.SeparatorMenuItem()) + if terminal.is_held_open: + item = Gtk.MenuItem.new_with_mnemonic(_('Relaunch Command')) + item.connect('activate', lambda x: terminal.spawn_child()) + menu.append(item) + menu.append(Gtk.SeparatorMenuItem()) + item = Gtk.CheckMenuItem.new_with_mnemonic(_('Show _scrollbar')) item.set_active(terminal.scrollbar.get_property('visible')) item.connect('toggled', lambda x: terminal.do_scrollbar_toggle()) diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index 8df29f3b..f42dfd3f 100644 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -105,10 +105,14 @@ class Titlebar(Gtk.EventBox): """Update our contents""" default_bg = False + temp_heldtext_str = '' temp_sizetext_str = '' + + if self.terminal.is_held_open: + temp_heldtext_str = _('[INACTIVE: Right-Click for Relaunch option] ') if not self.config['title_hide_sizetext']: temp_sizetext_str = " %s" % (self.sizetext) - self.label.set_text("%s%s" % (self.termtext, temp_sizetext_str)) + self.label.set_text("%s%s%s" % (temp_heldtext_str, self.termtext, temp_sizetext_str)) if (not self.config['title_use_system_font']) and self.config['title_font']: title_font = Pango.FontDescription(self.config['title_font']) From 427c65f2ccb8d2808918b8d146885f6eb0f4d281 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Sun, 27 Dec 2020 13:29:30 -0500 Subject: [PATCH 4/8] Revert "Merge pull request #36 from waldner/master" This reverts commit 6c56f32eeb4306371842bc1aba17b1b677ec0352, reversing changes made to 904676057e29f2d6953de834c78a8b80e579032f. --- terminatorlib/config.py | 5 ----- terminatorlib/container.py | 2 +- terminatorlib/notebook.py | 2 +- terminatorlib/paned.py | 24 +++++++++--------------- terminatorlib/prefseditor.py | 4 ---- terminatorlib/terminal.py | 22 +++++----------------- 6 files changed, 16 insertions(+), 43 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ec7a2a2e..3e069e21 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -111,7 +111,6 @@ DEFAULTS = { 'title_inactive_fg_color' : '#000000', 'title_inactive_bg_color' : '#c0bebf', 'inactive_color_offset': 0.8, - 'fast_resize_step': 50, 'enabled_plugins' : ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler'], @@ -160,10 +159,6 @@ DEFAULTS = { 'resize_down' : 'Down', 'resize_left' : 'Left', 'resize_right' : 'Right', - 'resize_up_fast' : 'Up', - 'resize_down_fast' : 'Down', - 'resize_left_fast' : 'Left', - 'resize_right_fast': 'Right', 'move_tab_right' : 'Page_Down', 'move_tab_left' : 'Page_Up', 'toggle_zoom' : 'x', diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 2b0fa33e..2afbe913 100644 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -130,7 +130,7 @@ class Container(object): self.terminator.group_hoover() return(True) - def resizeterm(self, widget, keyname, fast = False): + def resizeterm(self, widget, keyname): """Handle a keyboard event requesting a terminal resize""" raise NotImplementedError('resizeterm') diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 38917faf..52e70b9e 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -376,7 +376,7 @@ class Notebook(Container, Gtk.Notebook): err('Notebook::closetab: child is unknown type %s' % child) return - def resizeterm(self, widget, keyname, fast = False): + def resizeterm(self, widget, keyname): """Handle a keyboard event requesting a terminal resize""" raise NotImplementedError('resizeterm') diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index cb0e4a1c..f13b2cbd 100644 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -30,7 +30,7 @@ class Paned(Container): self.signals.append({'name': 'resize-term', 'flags': GObject.SignalFlags.RUN_LAST, 'return_type': None, - 'param_types': (GObject.TYPE_STRING, GObject.TYPE_BOOLEAN)}) + 'param_types': (GObject.TYPE_STRING,)}) # pylint: disable-msg=W0613 @@ -325,19 +325,16 @@ class Paned(Container): parent.replace(self, child) del(self) - def resizeterm(self, widget, keyname, fast = False): + def resizeterm(self, widget, keyname): """Handle a keyboard event requesting a terminal resize""" if keyname in ['up', 'down'] and isinstance(self, Gtk.VPaned): # This is a key we can handle position = self.get_position() - if not fast: - if self.maker.isinstance(widget, 'Terminal'): - fontheight = widget.vte.get_char_height() - else: - fontheight = 10 + if self.maker.isinstance(widget, 'Terminal'): + fontheight = widget.vte.get_char_height() else: - fontheight = self.config['fast_resize_step'] + fontheight = 10 if keyname == 'up': self.set_position(position - fontheight) @@ -347,13 +344,10 @@ class Paned(Container): # This is a key we can handle position = self.get_position() - if not fast: - if self.maker.isinstance(widget, 'Terminal'): - fontwidth = widget.vte.get_char_width() - else: - fontwidth = 10 + if self.maker.isinstance(widget, 'Terminal'): + fontwidth = widget.vte.get_char_width() else: - fontwidth = self.config['fast_resize_step'] + fontwidth = 10 if keyname == 'left': self.set_position(position - fontwidth) @@ -361,7 +355,7 @@ class Paned(Container): self.set_position(position + fontwidth) else: # This is not a key we can handle - self.emit('resize-term', keyname, fast) + self.emit('resize-term', keyname) def create_layout(self, layout): """Apply layout configuration""" diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 5e455f5a..136eb440 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -134,10 +134,6 @@ class PrefsEditor: 'resize_down' : _('Resize the terminal down'), 'resize_left' : _('Resize the terminal left'), 'resize_right' : _('Resize the terminal right'), - 'resize_up_fast' : _('Resize the terminal up (faster)'), - 'resize_down_fast' : _('Resize the terminal down (faster)'), - 'resize_left_fast' : _('Resize the terminal left (faster)'), - 'resize_right_fast': _('Resize the terminal right (faster)'), 'move_tab_right' : _('Move the tab right'), 'move_tab_left' : _('Move the tab left'), 'toggle_zoom' : _('Maximize terminal'), diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index d25fbc9b..42de222a 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -87,7 +87,7 @@ class Terminal(Gtk.VBox): 'maximise': (GObject.SignalFlags.RUN_LAST, None, ()), 'unzoom': (GObject.SignalFlags.RUN_LAST, None, ()), 'resize-term': (GObject.SignalFlags.RUN_LAST, None, - (GObject.TYPE_STRING, GObject.TYPE_BOOLEAN)), + (GObject.TYPE_STRING,)), 'navigate': (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING,)), 'tab-change': (GObject.SignalFlags.RUN_LAST, None, @@ -1820,28 +1820,16 @@ class Terminal(Gtk.VBox): self.close() def key_resize_up(self): - self.emit('resize-term', 'up', False) + self.emit('resize-term', 'up') def key_resize_down(self): - self.emit('resize-term', 'down', False) + self.emit('resize-term', 'down') def key_resize_left(self): - self.emit('resize-term', 'left', False) + self.emit('resize-term', 'left') def key_resize_right(self): - self.emit('resize-term', 'right', False) - - def key_resize_up_fast(self): - self.emit('resize-term', 'up', True) - - def key_resize_down_fast(self): - self.emit('resize-term', 'down', True) - - def key_resize_left_fast(self): - self.emit('resize-term', 'left', True) - - def key_resize_right_fast(self): - self.emit('resize-term', 'right', True) + self.emit('resize-term', 'right') def key_move_tab_right(self): self.emit('move-tab', 'right') From b85a344cb2f40837a56a7144756b8c5a88e042aa Mon Sep 17 00:00:00 2001 From: Jose Augusto Date: Sun, 27 Dec 2020 17:55:53 -0300 Subject: [PATCH 5/8] fix: #323 --- terminatorlib/terminal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 42de222a..f95b8141 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1523,9 +1523,7 @@ class Terminal(Gtk.VBox): url = urlmatch[0] match = urlmatch[1] - if match == self.matches['email'] and url[0:7] != 'mailto:': - url = 'mailto:' + url - elif match == self.matches['addr_only'] and url[0:3] == 'ftp': + if match == self.matches['addr_only'] and url[0:3] == 'ftp': url = 'ftp://' + url elif match == self.matches['addr_only']: url = 'http://' + url From a53dea6fa59f1bc663e7c7bc0370a0ebb74cf2a7 Mon Sep 17 00:00:00 2001 From: Jose Augusto Date: Sun, 27 Dec 2020 19:48:41 -0300 Subject: [PATCH 6/8] remove rewrap on resize from option and remove functions too --- doc/terminator_config.5 | 3 --- terminatorlib/config.py | 1 - terminatorlib/preferences.glade | 17 ----------------- terminatorlib/prefseditor.py | 8 -------- terminatorlib/terminal.py | 3 --- 5 files changed, 32 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 610c6767..e577a3d3 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -498,9 +498,6 @@ Default value: \fBUTF-8\fR If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. Default value: \fBFalse\fR .TP -.B rewrap_on_resize \fR(boolean) -If True, the terminal contents are rewrapped when the terminal's width changes. Warning: This might be slow if you have a huge scrollback buffer. -Default value: \fBTrue\fR .SH layouts diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 3e069e21..d5a7b2f1 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -250,7 +250,6 @@ DEFAULTS = { 'force_no_bell' : False, 'cycle_term_tab' : True, 'copy_on_selection' : False, - 'rewrap_on_resize' : True, 'split_to_group' : False, 'autoclean_groups' : True, 'http_proxy' : '', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index ab7b02ee..773cf4ac 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1752,23 +1752,6 @@ 4 - - - Rewrap on resize - False - True - True - False - 0.5 - True - - - - False - False - 5 - - Disable Ctrl+mousewheel zoom diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 136eb440..51221730 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -482,9 +482,6 @@ class PrefsEditor: # Copy on selection widget = guiget('copy_on_selection') widget.set_active(self.config['copy_on_selection']) - # Rewrap on resize - widget = guiget('rewrap_on_resize_checkbutton') - widget.set_active(self.config['rewrap_on_resize']) # Word chars widget = guiget('word_chars_entry') widget.set_text(self.config['word_chars']) @@ -802,11 +799,6 @@ class PrefsEditor: self.config['copy_on_selection'] = widget.get_active() self.config.save() - def on_rewrap_on_resize_toggled(self, widget): - """Rewrap on resize setting changed""" - self.config['rewrap_on_resize'] = widget.get_active() - self.config.save() - def on_putty_paste_style_toggled(self, widget): """Putty paste style setting changed""" self.config['putty_paste_style'] = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 42de222a..5370a4db 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -827,9 +827,6 @@ class Terminal(Gtk.VBox): elif self.config['scrollbar_position'] == 'right': self.terminalbox.reorder_child(self.vte, 0) - - self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize']) - self.titlebar.update() self.vte.queue_draw() From 80f87aada418879ba6bdc4402ff76a7795a45eee Mon Sep 17 00:00:00 2001 From: David Sowder Date: Sun, 27 Dec 2020 20:52:38 -0600 Subject: [PATCH 7/8] Remove a trailing space (trivial change to retry checks after the repo was returned to a check-working state) --- terminatorlib/terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index a11b734f..7031d84a 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -38,7 +38,7 @@ class Overpaint(Vte.Terminal): self.config = Config() ### inactive_color_offset is the opposite of alpha level self.dim_p = float(self.config['inactive_color_offset']) - self.dim_l = round(1.0 - self.dim_p,3) + self.dim_l = round(1.0 - self.dim_p,3) def dim(self,b): self.overpaint = b From bb47af6d9b930980089ccdd543e06d16a322b62c Mon Sep 17 00:00:00 2001 From: Jose Augusto Date: Mon, 28 Dec 2020 15:23:34 -0300 Subject: [PATCH 8/8] feat: Migrating from hbox to GtkBox --- terminatorlib/terminal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 42de222a..8ef3e500 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -294,8 +294,8 @@ class Terminal(Gtk.VBox): def create_terminalbox(self): """Create a GtkHBox containing the terminal and a scrollbar""" - terminalbox = Gtk.HBox() - self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment()) + terminalbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) + self.scrollbar = Gtk.Scrollbar.new(Gtk.Orientation.VERTICAL, adjustment=self.vte.get_vadjustment()) self.scrollbar.set_no_show_all(True) terminalbox.pack_start(self.vte, True, True, 0)