Skip to content

Commit

Permalink
fix #85 regexps are not handled due to deprecated functions use
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudtaxi committed Oct 26, 2020
1 parent 0916bd6 commit 485d24e
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions [email protected]/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,12 @@ const DropDownTerminalX = new Lang.Class({
_addUriMatchers: function (tab) {
// adds the uri matchers
this._uriHandlingPropertiesbyTag = {}
UriHandlingProperties.forEach(Lang.bind(this, function (hp) {
const regex = GLib.Regex.new(hp.pattern, GLib.RegexCompileFlags.CASELESS | GLib.RegexCompileFlags.OPTIMIZE, 0)
const tag = tab.terminal.match_add_gregex(regex, 0)
UriHandlingProperties.forEach((hp) => {
const regex = new Vte.Regex(hp.pattern, hp.pattern.length, Vte.REGEX_FLAGS_DEFAULT)
const tag = tab.terminal.match_add_regex(regex, 0)
tab.terminal.match_set_cursor_type(tag, Gdk.CursorType.HAND2)
this._uriHandlingPropertiesbyTag[tag] = hp
}))
})
},

_getTabName (tabNumber, tabLabel = 'shell') {
Expand Down Expand Up @@ -557,7 +557,7 @@ const DropDownTerminalX = new Lang.Class({
return workingDir.replace(new RegExp(/file:\/\/.*?\/(.*)/g), '/$1')
},

_createTerminalTab () {
_createTerminalTab () {
const terminal = this._createTerminalView()

const onExit = terminal.connect('child-exited', () => {
Expand Down Expand Up @@ -1064,22 +1064,12 @@ const DropDownTerminalX = new Lang.Class({
const [is_button, button] = event.get_button()

// opens hovered link on ctrl+left-click
if (is_button && button == Gdk.BUTTON_PRIMARY && (state & Gdk.ModifierType.CONTROL_MASK)) {
const [preserved, x, y] = event.get_coords()

const border = new Gtk.Border()
terminal.style_get_property('inner-border', border)

const column = (x - border.left) / terminal.get_char_width()
const row = (y - border.top) / terminal.get_char_height()

const [match, tag] = terminal.match_check(column, row)

if (is_button && button == Gdk.BUTTON_PRIMARY && (state & Gdk.ModifierType.CONTROL_MASK)) {
const [match, tag] = terminal.match_check_event(event)
if (match) {
const properties = this._uriHandlingPropertiesbyTag[tag]
this._openUri(match, properties.flavor, event.get_screen(), event.get_time())
}

return true
}

Expand All @@ -1103,7 +1093,8 @@ const DropDownTerminalX = new Lang.Class({
uri = 'mailto:' + uri
}

Gtk.show_uri(screen, uri, time)
Gtk.show_uri_on_window(this._window, uri, time)
// Gtk.show_uri(screen, uri, time)
},

_getCommandArgs () {
Expand Down

0 comments on commit 485d24e

Please sign in to comment.