Merge pull request #1 from gnome-terminator/master

Sync with upstream
This commit is contained in:
David Sowder 2020-12-28 12:51:36 -06:00 committed by GitHub
commit 4a3dc0c35b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 86 deletions

View File

@ -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** **Describe the bug**
A clear and concise description of what the bug is. A clear and concise description of what the bug is.

View File

@ -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. 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 Default value: \fBFalse\fR
.TP .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 .SH layouts

View File

@ -111,7 +111,6 @@ DEFAULTS = {
'title_inactive_fg_color' : '#000000', 'title_inactive_fg_color' : '#000000',
'title_inactive_bg_color' : '#c0bebf', 'title_inactive_bg_color' : '#c0bebf',
'inactive_color_offset': 0.8, 'inactive_color_offset': 0.8,
'fast_resize_step': 50,
'enabled_plugins' : ['LaunchpadBugURLHandler', 'enabled_plugins' : ['LaunchpadBugURLHandler',
'LaunchpadCodeURLHandler', 'LaunchpadCodeURLHandler',
'APTURLHandler'], 'APTURLHandler'],
@ -160,10 +159,6 @@ DEFAULTS = {
'resize_down' : '<Shift><Control>Down', 'resize_down' : '<Shift><Control>Down',
'resize_left' : '<Shift><Control>Left', 'resize_left' : '<Shift><Control>Left',
'resize_right' : '<Shift><Control>Right', 'resize_right' : '<Shift><Control>Right',
'resize_up_fast' : '<Shift>Up',
'resize_down_fast' : '<Shift>Down',
'resize_left_fast' : '<Shift>Left',
'resize_right_fast': '<Shift>Right',
'move_tab_right' : '<Shift><Control>Page_Down', 'move_tab_right' : '<Shift><Control>Page_Down',
'move_tab_left' : '<Shift><Control>Page_Up', 'move_tab_left' : '<Shift><Control>Page_Up',
'toggle_zoom' : '<Shift><Control>x', 'toggle_zoom' : '<Shift><Control>x',
@ -255,7 +250,6 @@ DEFAULTS = {
'force_no_bell' : False, 'force_no_bell' : False,
'cycle_term_tab' : True, 'cycle_term_tab' : True,
'copy_on_selection' : False, 'copy_on_selection' : False,
'rewrap_on_resize' : True,
'split_to_group' : False, 'split_to_group' : False,
'autoclean_groups' : True, 'autoclean_groups' : True,
'http_proxy' : '', 'http_proxy' : '',

View File

@ -130,7 +130,7 @@ class Container(object):
self.terminator.group_hoover() self.terminator.group_hoover()
return(True) return(True)
def resizeterm(self, widget, keyname, fast = False): def resizeterm(self, widget, keyname):
"""Handle a keyboard event requesting a terminal resize""" """Handle a keyboard event requesting a terminal resize"""
raise NotImplementedError('resizeterm') raise NotImplementedError('resizeterm')

View File

@ -376,7 +376,7 @@ class Notebook(Container, Gtk.Notebook):
err('Notebook::closetab: child is unknown type %s' % child) err('Notebook::closetab: child is unknown type %s' % child)
return return
def resizeterm(self, widget, keyname, fast = False): def resizeterm(self, widget, keyname):
"""Handle a keyboard event requesting a terminal resize""" """Handle a keyboard event requesting a terminal resize"""
raise NotImplementedError('resizeterm') raise NotImplementedError('resizeterm')

View File

@ -30,7 +30,7 @@ class Paned(Container):
self.signals.append({'name': 'resize-term', self.signals.append({'name': 'resize-term',
'flags': GObject.SignalFlags.RUN_LAST, 'flags': GObject.SignalFlags.RUN_LAST,
'return_type': None, 'return_type': None,
'param_types': (GObject.TYPE_STRING, GObject.TYPE_BOOLEAN)}) 'param_types': (GObject.TYPE_STRING,)})
# pylint: disable-msg=W0613 # pylint: disable-msg=W0613
@ -325,19 +325,16 @@ class Paned(Container):
parent.replace(self, child) parent.replace(self, child)
del(self) del(self)
def resizeterm(self, widget, keyname, fast = False): def resizeterm(self, widget, keyname):
"""Handle a keyboard event requesting a terminal resize""" """Handle a keyboard event requesting a terminal resize"""
if keyname in ['up', 'down'] and isinstance(self, Gtk.VPaned): if keyname in ['up', 'down'] and isinstance(self, Gtk.VPaned):
# This is a key we can handle # This is a key we can handle
position = self.get_position() position = self.get_position()
if not fast: if self.maker.isinstance(widget, 'Terminal'):
if self.maker.isinstance(widget, 'Terminal'): fontheight = widget.vte.get_char_height()
fontheight = widget.vte.get_char_height()
else:
fontheight = 10
else: else:
fontheight = self.config['fast_resize_step'] fontheight = 10
if keyname == 'up': if keyname == 'up':
self.set_position(position - fontheight) self.set_position(position - fontheight)
@ -347,13 +344,10 @@ class Paned(Container):
# This is a key we can handle # This is a key we can handle
position = self.get_position() position = self.get_position()
if not fast: if self.maker.isinstance(widget, 'Terminal'):
if self.maker.isinstance(widget, 'Terminal'): fontwidth = widget.vte.get_char_width()
fontwidth = widget.vte.get_char_width()
else:
fontwidth = 10
else: else:
fontwidth = self.config['fast_resize_step'] fontwidth = 10
if keyname == 'left': if keyname == 'left':
self.set_position(position - fontwidth) self.set_position(position - fontwidth)
@ -361,7 +355,7 @@ class Paned(Container):
self.set_position(position + fontwidth) self.set_position(position + fontwidth)
else: else:
# This is not a key we can handle # This is not a key we can handle
self.emit('resize-term', keyname, fast) self.emit('resize-term', keyname)
def create_layout(self, layout): def create_layout(self, layout):
"""Apply layout configuration""" """Apply layout configuration"""

View File

@ -1752,23 +1752,6 @@
<property name="position">4</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="rewrap_on_resize_checkbutton">
<property name="label" translatable="yes">Rewrap on resize</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_rewrap_on_resize_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="disablemousewheelzoom"> <object class="GtkCheckButton" id="disablemousewheelzoom">
<property name="label" translatable="yes">Disable Ctrl+mousewheel zoom</property> <property name="label" translatable="yes">Disable Ctrl+mousewheel zoom</property>

View File

@ -134,10 +134,6 @@ class PrefsEditor:
'resize_down' : _('Resize the terminal down'), 'resize_down' : _('Resize the terminal down'),
'resize_left' : _('Resize the terminal left'), 'resize_left' : _('Resize the terminal left'),
'resize_right' : _('Resize the terminal right'), '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_right' : _('Move the tab right'),
'move_tab_left' : _('Move the tab left'), 'move_tab_left' : _('Move the tab left'),
'toggle_zoom' : _('Maximize terminal'), 'toggle_zoom' : _('Maximize terminal'),
@ -486,9 +482,6 @@ class PrefsEditor:
# Copy on selection # Copy on selection
widget = guiget('copy_on_selection') widget = guiget('copy_on_selection')
widget.set_active(self.config['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 # Word chars
widget = guiget('word_chars_entry') widget = guiget('word_chars_entry')
widget.set_text(self.config['word_chars']) widget.set_text(self.config['word_chars'])
@ -806,11 +799,6 @@ class PrefsEditor:
self.config['copy_on_selection'] = widget.get_active() self.config['copy_on_selection'] = widget.get_active()
self.config.save() 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): def on_putty_paste_style_toggled(self, widget):
"""Putty paste style setting changed""" """Putty paste style setting changed"""
self.config['putty_paste_style'] = widget.get_active() self.config['putty_paste_style'] = widget.get_active()

View File

@ -38,7 +38,7 @@ class Overpaint(Vte.Terminal):
self.config = Config() self.config = Config()
### inactive_color_offset is the opposite of alpha level ### inactive_color_offset is the opposite of alpha level
self.dim_p = float(self.config['inactive_color_offset']) 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): def dim(self,b):
self.overpaint = b self.overpaint = b
@ -87,7 +87,7 @@ class Terminal(Gtk.VBox):
'maximise': (GObject.SignalFlags.RUN_LAST, None, ()), 'maximise': (GObject.SignalFlags.RUN_LAST, None, ()),
'unzoom': (GObject.SignalFlags.RUN_LAST, None, ()), 'unzoom': (GObject.SignalFlags.RUN_LAST, None, ()),
'resize-term': (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, 'navigate': (GObject.SignalFlags.RUN_LAST, None,
(GObject.TYPE_STRING,)), (GObject.TYPE_STRING,)),
'tab-change': (GObject.SignalFlags.RUN_LAST, None, 'tab-change': (GObject.SignalFlags.RUN_LAST, None,
@ -126,8 +126,11 @@ class Terminal(Gtk.VBox):
custom_encoding = None custom_encoding = None
custom_font_size = None custom_font_size = None
layout_command = None layout_command = None
relaunch_command = None
directory = None directory = None
is_held_open = False
fgcolor_active = None fgcolor_active = None
bgcolor = None bgcolor = None
palette_active = None palette_active = None
@ -294,8 +297,8 @@ class Terminal(Gtk.VBox):
def create_terminalbox(self): def create_terminalbox(self):
"""Create a GtkHBox containing the terminal and a scrollbar""" """Create a GtkHBox containing the terminal and a scrollbar"""
terminalbox = Gtk.HBox() terminalbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment()) self.scrollbar = Gtk.Scrollbar.new(Gtk.Orientation.VERTICAL, adjustment=self.vte.get_vadjustment())
self.scrollbar.set_no_show_all(True) self.scrollbar.set_no_show_all(True)
terminalbox.pack_start(self.vte, True, True, 0) terminalbox.pack_start(self.vte, True, True, 0)
@ -676,6 +679,8 @@ class Terminal(Gtk.VBox):
if self.config['exit_action'] == 'restart': if self.config['exit_action'] == 'restart':
self.cnxids.new(self.vte, 'child-exited', self.spawn_child, True) 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'): elif self.config['exit_action'] in ('close', 'left'):
self.cnxids.new(self.vte, 'child-exited', self.cnxids.new(self.vte, 'child-exited',
lambda x, y: self.emit('close-term')) lambda x, y: self.emit('close-term'))
@ -827,9 +832,6 @@ class Terminal(Gtk.VBox):
elif self.config['scrollbar_position'] == 'right': elif self.config['scrollbar_position'] == 'right':
self.terminalbox.reorder_child(self.vte, 0) self.terminalbox.reorder_child(self.vte, 0)
self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize'])
self.titlebar.update() self.titlebar.update()
self.vte.queue_draw() self.vte.queue_draw()
@ -1429,6 +1431,10 @@ class Terminal(Gtk.VBox):
if cwd is not None: if cwd is not None:
self.cwd = cwd 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): def spawn_child(self, widget=None, respawn=False, debugserver=False):
args = [] args = []
shell = None shell = None
@ -1441,13 +1447,19 @@ class Terminal(Gtk.VBox):
if respawn == False: if respawn == False:
self.vte.grab_focus() self.vte.grab_focus()
self.is_held_open = False
options = self.config.options_get() options = self.config.options_get()
if options and options.command: if options and options.command:
command = options.command command = options.command
self.relaunch_command = command
options.command = None options.command = None
elif options and options.execute: elif options and options.execute:
command = options.execute command = options.execute
self.relaunch_command = command
options.execute = None options.execute = None
elif self.relaunch_command:
command = self.relaunch_command
elif self.config['use_custom_command']: elif self.config['use_custom_command']:
command = self.config['custom_command'] command = self.config['custom_command']
elif self.layout_command: elif self.layout_command:
@ -1523,9 +1535,7 @@ class Terminal(Gtk.VBox):
url = urlmatch[0] url = urlmatch[0]
match = urlmatch[1] match = urlmatch[1]
if match == self.matches['email'] and url[0:7] != 'mailto:': if match == self.matches['addr_only'] and url[0:3] == 'ftp':
url = 'mailto:' + url
elif match == self.matches['addr_only'] and url[0:3] == 'ftp':
url = 'ftp://' + url url = 'ftp://' + url
elif match == self.matches['addr_only']: elif match == self.matches['addr_only']:
url = 'http://' + url url = 'http://' + url
@ -1820,28 +1830,16 @@ class Terminal(Gtk.VBox):
self.close() self.close()
def key_resize_up(self): def key_resize_up(self):
self.emit('resize-term', 'up', False) self.emit('resize-term', 'up')
def key_resize_down(self): def key_resize_down(self):
self.emit('resize-term', 'down', False) self.emit('resize-term', 'down')
def key_resize_left(self): def key_resize_left(self):
self.emit('resize-term', 'left', False) self.emit('resize-term', 'left')
def key_resize_right(self): def key_resize_right(self):
self.emit('resize-term', 'right', False) self.emit('resize-term', 'right')
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)
def key_move_tab_right(self): def key_move_tab_right(self):
self.emit('move-tab', 'right') self.emit('move-tab', 'right')

View File

@ -179,6 +179,12 @@ class TerminalPopupMenu(object):
menu.append(item) menu.append(item)
menu.append(Gtk.SeparatorMenuItem()) 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 = Gtk.CheckMenuItem.new_with_mnemonic(_('Show _scrollbar'))
item.set_active(terminal.scrollbar.get_property('visible')) item.set_active(terminal.scrollbar.get_property('visible'))
item.connect('toggled', lambda x: terminal.do_scrollbar_toggle()) item.connect('toggled', lambda x: terminal.do_scrollbar_toggle())

View File

@ -104,10 +104,15 @@ class Titlebar(Gtk.EventBox):
def update(self, other=None): def update(self, other=None):
"""Update our contents""" """Update our contents"""
default_bg = False default_bg = False
if self.config['title_hide_sizetext']:
self.label.set_text("%s" % self.termtext) temp_heldtext_str = ''
else: temp_sizetext_str = ''
self.label.set_text("%s %s" % (self.termtext, self.sizetext))
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%s" % (temp_heldtext_str, self.termtext, temp_sizetext_str))
if (not self.config['title_use_system_font']) and self.config['title_font']: if (not self.config['title_use_system_font']) and self.config['title_font']:
title_font = Pango.FontDescription(self.config['title_font']) title_font = Pango.FontDescription(self.config['title_font'])