The remainder of Egmont's GTK3 patch-o-rama session
* Remove the now unused posix regex code, and set the regex boundary vars to the correct '\b' value * Fix drag and drop of a link from Firefox / Chrome * Fix the editing of the window title * Fix closing window using short-cut * Fix profile re-use when opening new window * Fix scrollbar position on current terminals when changed in prefs
This commit is contained in:
commit
08168b64ab
13
ChangeLog
13
ChangeLog
|
@ -66,6 +66,19 @@ terminator GTK3:
|
||||||
insert from clipboard instead (Mattias Eriksson)
|
insert from clipboard instead (Mattias Eriksson)
|
||||||
* Remove invalid double-quote (") from the pathchar for url regex
|
* Remove invalid double-quote (") from the pathchar for url regex
|
||||||
matching (Steve Boddy, LP#1514578)
|
matching (Steve Boddy, LP#1514578)
|
||||||
|
* Remove the now unused posix regex code, and set the regex
|
||||||
|
boundary vars to the correct '\b' value (Matt Rose, Egmont
|
||||||
|
Koblinger, Steve Boddy, LP#1521509)
|
||||||
|
* Fix drag and drop of a link from Firefox / Chrome (Egmont
|
||||||
|
Koblinger, LP#1518705)
|
||||||
|
* Fix the editing of the window title (Egmont Koblinger,
|
||||||
|
LP#1520371)
|
||||||
|
* Fix closing window using short-cut (Egmont Koblinger,
|
||||||
|
LP#1520372)
|
||||||
|
* Fix profile re-use when opening new window (Egmont Koblinger,
|
||||||
|
LP#1520705)
|
||||||
|
* Fix scrollbar position on current terminals when changed in
|
||||||
|
prefs (Egmont Koblinger, LP#1520761)
|
||||||
|
|
||||||
terminator 0.97:
|
terminator 0.97:
|
||||||
* Allow font dimming in inactive terminals
|
* Allow font dimming in inactive terminals
|
||||||
|
|
|
@ -104,7 +104,6 @@ DEFAULTS = {
|
||||||
'always_on_top' : False,
|
'always_on_top' : False,
|
||||||
'hide_on_lose_focus' : False,
|
'hide_on_lose_focus' : False,
|
||||||
'sticky' : False,
|
'sticky' : False,
|
||||||
'try_posix_regexp' : platform.system() != 'Linux',
|
|
||||||
'use_custom_url_handler': False,
|
'use_custom_url_handler': False,
|
||||||
'custom_url_handler' : '',
|
'custom_url_handler' : '',
|
||||||
'disable_real_transparency' : False,
|
'disable_real_transparency' : False,
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Terminal(Gtk.VBox):
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET_TYPE_VTE = 8
|
TARGET_TYPE_VTE = 8
|
||||||
|
TARGET_TYPE_MOZ = 9
|
||||||
|
|
||||||
MOUSEBUTTON_LEFT = 1
|
MOUSEBUTTON_LEFT = 1
|
||||||
MOUSEBUTTON_MIDDLE = 2
|
MOUSEBUTTON_MIDDLE = 2
|
||||||
|
@ -77,7 +78,6 @@ class Terminal(Gtk.VBox):
|
||||||
vte = None
|
vte = None
|
||||||
terminalbox = None
|
terminalbox = None
|
||||||
scrollbar = None
|
scrollbar = None
|
||||||
scrollbar_position = None
|
|
||||||
titlebar = None
|
titlebar = None
|
||||||
searchbar = None
|
searchbar = None
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.show()
|
self.vte.show()
|
||||||
|
|
||||||
self.default_encoding = self.vte.get_encoding()
|
self.default_encoding = self.vte.get_encoding()
|
||||||
self.update_url_matches(self.config['try_posix_regexp'])
|
self.update_url_matches()
|
||||||
|
|
||||||
self.terminalbox = self.create_terminalbox()
|
self.terminalbox = self.create_terminalbox()
|
||||||
|
|
||||||
|
@ -240,24 +240,14 @@ class Terminal(Gtk.VBox):
|
||||||
|
|
||||||
terminalbox = Gtk.HBox()
|
terminalbox = Gtk.HBox()
|
||||||
self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment())
|
self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment())
|
||||||
self.scrollbar.set_no_show_all(True)
|
|
||||||
self.scrollbar_position = self.config['scrollbar_position']
|
|
||||||
|
|
||||||
if self.scrollbar_position not in ('hidden', 'disabled'):
|
terminalbox.pack_start(self.vte, True, True, 0)
|
||||||
self.scrollbar.show()
|
terminalbox.pack_start(self.scrollbar, False, True, 0)
|
||||||
|
|
||||||
if self.scrollbar_position == 'left':
|
|
||||||
func = terminalbox.pack_end
|
|
||||||
else:
|
|
||||||
func = terminalbox.pack_start
|
|
||||||
|
|
||||||
func(self.vte, True, True, 0)
|
|
||||||
func(self.scrollbar, False, True, 0)
|
|
||||||
terminalbox.show_all()
|
terminalbox.show_all()
|
||||||
|
|
||||||
return(terminalbox)
|
return(terminalbox)
|
||||||
|
|
||||||
def update_url_matches(self, posix = True):
|
def update_url_matches(self):
|
||||||
"""Update the regexps used to match URLs"""
|
"""Update the regexps used to match URLs"""
|
||||||
userchars = "-A-Za-z0-9"
|
userchars = "-A-Za-z0-9"
|
||||||
passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
|
passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
|
||||||
|
@ -267,22 +257,8 @@ class Terminal(Gtk.VBox):
|
||||||
user = "[" + userchars + "]+(:[" + passchars + "]+)?"
|
user = "[" + userchars + "]+(:[" + passchars + "]+)?"
|
||||||
urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]"
|
urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]"
|
||||||
|
|
||||||
if posix:
|
lboundry = "\\b"
|
||||||
dbg ('Terminal::update_url_matches: Trying POSIX URL regexps')
|
rboundry = "\\b"
|
||||||
lboundry = "[[:<:]]"
|
|
||||||
rboundry = "[[:>:]]"
|
|
||||||
else: # GNU
|
|
||||||
dbg ('Terminal::update_url_matches: Trying GNU URL regexps')
|
|
||||||
lboundry = "\\<"
|
|
||||||
rboundry = "\\>"
|
|
||||||
|
|
||||||
# VERIFY/FIXME FOR GTK3: What's this with the POSIX and GNU mode l/r boundry[sic] values?
|
|
||||||
# Neither of the two works for me since the Vte 0.38 update.
|
|
||||||
# Should we get rid of them and the try_posix_regexp option totally?
|
|
||||||
# They don't seem to be necessary, and there really shouldn't be any difference
|
|
||||||
# between Linux and non-Linux systems, GLib should hide this (does it?).
|
|
||||||
lboundry = ''
|
|
||||||
rboundry = ''
|
|
||||||
|
|
||||||
re = (lboundry + schemes +
|
re = (lboundry + schemes +
|
||||||
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
|
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
|
||||||
|
@ -291,10 +267,6 @@ class Terminal(Gtk.VBox):
|
||||||
self.matches['full_uri'] = self.vte.match_add_gregex(reg, 0)
|
self.matches['full_uri'] = self.vte.match_add_gregex(reg, 0)
|
||||||
|
|
||||||
if self.matches['full_uri'] == -1:
|
if self.matches['full_uri'] == -1:
|
||||||
if posix:
|
|
||||||
err ('Terminal::update_url_matches: POSIX failed, trying GNU')
|
|
||||||
self.update_url_matches(posix = False)
|
|
||||||
else:
|
|
||||||
err ('Terminal::update_url_matches: Failed adding URL matches')
|
err ('Terminal::update_url_matches: Failed adding URL matches')
|
||||||
else:
|
else:
|
||||||
re = (lboundry +
|
re = (lboundry +
|
||||||
|
@ -372,7 +344,7 @@ class Terminal(Gtk.VBox):
|
||||||
|
|
||||||
srcvtetargets = [("vte", Gtk.TargetFlags.SAME_APP, self.TARGET_TYPE_VTE)]
|
srcvtetargets = [("vte", Gtk.TargetFlags.SAME_APP, self.TARGET_TYPE_VTE)]
|
||||||
dsttargets = [("vte", Gtk.TargetFlags.SAME_APP, self.TARGET_TYPE_VTE),
|
dsttargets = [("vte", Gtk.TargetFlags.SAME_APP, self.TARGET_TYPE_VTE),
|
||||||
('text/x-moz-url', 0, 0),
|
('text/x-moz-url', 0, self.TARGET_TYPE_MOZ),
|
||||||
('_NETSCAPE_URL', 0, 0)]
|
('_NETSCAPE_URL', 0, 0)]
|
||||||
'''
|
'''
|
||||||
The following should work, but on my system it corrupts the returned
|
The following should work, but on my system it corrupts the returned
|
||||||
|
@ -792,16 +764,14 @@ class Terminal(Gtk.VBox):
|
||||||
self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke'])
|
self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke'])
|
||||||
self.vte.set_scroll_on_output(self.config['scroll_on_output'])
|
self.vte.set_scroll_on_output(self.config['scroll_on_output'])
|
||||||
|
|
||||||
if self.scrollbar_position != self.config['scrollbar_position']:
|
|
||||||
self.scrollbar_position = self.config['scrollbar_position']
|
|
||||||
if self.config['scrollbar_position'] in ['disabled', 'hidden']:
|
if self.config['scrollbar_position'] in ['disabled', 'hidden']:
|
||||||
self.scrollbar.hide()
|
self.scrollbar.hide()
|
||||||
else:
|
else:
|
||||||
self.scrollbar.show()
|
self.scrollbar.show()
|
||||||
if self.config['scrollbar_position'] == 'left': # FIXME FOR GTK3: moving the scrollbar to the other side (by changing prefs) doesn't work
|
if self.config['scrollbar_position'] == 'left':
|
||||||
self.reorder_child(self.scrollbar, 0)
|
self.terminalbox.reorder_child(self.scrollbar, 0)
|
||||||
elif self.config['scrollbar_position'] == 'right':
|
elif self.config['scrollbar_position'] == 'right':
|
||||||
self.reorder_child(self.vte, 0)
|
self.terminalbox.reorder_child(self.vte, 0)
|
||||||
|
|
||||||
self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize'])
|
self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize'])
|
||||||
|
|
||||||
|
@ -1088,7 +1058,7 @@ class Terminal(Gtk.VBox):
|
||||||
return(False)
|
return(False)
|
||||||
|
|
||||||
def on_drag_data_received(self, widget, drag_context, x, y, selection_data,
|
def on_drag_data_received(self, widget, drag_context, x, y, selection_data,
|
||||||
_info, _time, data):
|
info, _time, data):
|
||||||
"""Something has been dragged into the terminal. Handle it as either a
|
"""Something has been dragged into the terminal. Handle it as either a
|
||||||
URL or another terminal."""
|
URL or another terminal."""
|
||||||
dbg('drag data received of type: %s' % (selection_data.get_data_type()))
|
dbg('drag data received of type: %s' % (selection_data.get_data_type()))
|
||||||
|
@ -1096,6 +1066,12 @@ class Terminal(Gtk.VBox):
|
||||||
Gtk.targets_include_uri(drag_context.list_targets()):
|
Gtk.targets_include_uri(drag_context.list_targets()):
|
||||||
# copy text with no modification yet to destination
|
# copy text with no modification yet to destination
|
||||||
txt = selection_data.get_data()
|
txt = selection_data.get_data()
|
||||||
|
|
||||||
|
# https://bugs.launchpad.net/terminator/+bug/1518705
|
||||||
|
if info == self.TARGET_TYPE_MOZ:
|
||||||
|
txt = txt.decode('utf-16').encode('utf-8')
|
||||||
|
txt = txt.split('\n')[0]
|
||||||
|
|
||||||
txt_lines = txt.split( "\r\n" )
|
txt_lines = txt.split( "\r\n" )
|
||||||
if txt_lines[-1] == '':
|
if txt_lines[-1] == '':
|
||||||
for line in txt_lines[:-1]:
|
for line in txt_lines[:-1]:
|
||||||
|
@ -1827,7 +1803,7 @@ class Terminal(Gtk.VBox):
|
||||||
self.emit('ungroup-tab')
|
self.emit('ungroup-tab')
|
||||||
|
|
||||||
def key_new_window(self):
|
def key_new_window(self):
|
||||||
self.terminator.new_window(self.get_cwd())
|
self.terminator.new_window(self.get_cwd(), self.get_profile())
|
||||||
|
|
||||||
def key_new_tab(self):
|
def key_new_tab(self):
|
||||||
self.get_toplevel().tab_new(self)
|
self.get_toplevel().tab_new(self)
|
||||||
|
@ -1860,7 +1836,6 @@ class Terminal(Gtk.VBox):
|
||||||
( Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
|
( Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
|
||||||
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT ))
|
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT ))
|
||||||
dialog.set_default_response(Gtk.ResponseType.ACCEPT)
|
dialog.set_default_response(Gtk.ResponseType.ACCEPT)
|
||||||
dialog.set_has_separator(False)
|
|
||||||
dialog.set_resizable(False)
|
dialog.set_resizable(False)
|
||||||
dialog.set_border_width(8)
|
dialog.set_border_width(8)
|
||||||
|
|
||||||
|
|
|
@ -201,13 +201,15 @@ class Terminator(Borg):
|
||||||
return terminal
|
return terminal
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def new_window(self, cwd=None):
|
def new_window(self, cwd=None, profile=None):
|
||||||
"""Create a window with a Terminal in it"""
|
"""Create a window with a Terminal in it"""
|
||||||
maker = Factory()
|
maker = Factory()
|
||||||
window = maker.make('Window')
|
window = maker.make('Window')
|
||||||
terminal = maker.make('Terminal')
|
terminal = maker.make('Terminal')
|
||||||
if cwd:
|
if cwd:
|
||||||
terminal.set_cwd(cwd)
|
terminal.set_cwd(cwd)
|
||||||
|
if profile and self.config['always_split_with_profile']:
|
||||||
|
terminal.force_set_profile(None, profile)
|
||||||
window.add(terminal)
|
window.add(terminal)
|
||||||
window.show(True)
|
window.show(True)
|
||||||
terminal.spawn_child()
|
terminal.spawn_child()
|
||||||
|
|
|
@ -208,9 +208,9 @@ class Window(Container, Gtk.Window):
|
||||||
self.set_fullscreen(not self.isfullscreen)
|
self.set_fullscreen(not self.isfullscreen)
|
||||||
elif mapping == 'close_window':
|
elif mapping == 'close_window':
|
||||||
if not self.on_delete_event(window,
|
if not self.on_delete_event(window,
|
||||||
Gdk.Event(Gdk.DELETE)):
|
Gdk.Event.new(Gdk.EventType.DELETE)):
|
||||||
self.on_destroy_event(window,
|
self.on_destroy_event(window,
|
||||||
Gdk.Event(Gdk.DESTROY))
|
Gdk.Event.new(Gdk.EventType.DESTROY))
|
||||||
else:
|
else:
|
||||||
return(False)
|
return(False)
|
||||||
return(True)
|
return(True)
|
||||||
|
|
Loading…
Reference in New Issue