topinambour 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 658f66555184e2186a21c944bb2d98538eeb1bd8
4
- data.tar.gz: 1fb7a37aaee8a9b8f6ffbb0703c0b0eaa7eadca2
3
+ metadata.gz: c91b7f16f9c3141e6876f79ce6246daf0567c8ff
4
+ data.tar.gz: b0cf30204239e75195eae1a90101aad66fca0c1c
5
5
  SHA512:
6
- metadata.gz: a9805c6e16ec8a9a133253e6c3400cf04cffeca79a5fa75a5e534de8ecad0d8630d7eb9b96fad8f94efb2d73f20a70810e3b7233d6db4fda21a2143a892a5375
7
- data.tar.gz: da3d12005d90dfa7fd2eb5d9548107885db6a664a62fa9d1acb66b65a36826f50d6dd067c8ae945acd786a728fb9cfc24ed23147b6c573de74c29baaf7605abc
6
+ metadata.gz: 5b30bc9a61ebe66aac157a017481ca40041628623abddd15b62f9b9ba732d1340a8987a6474bf292abe2385d65d9db45302fd2bf0bfb896ea6e681d802a40b16
7
+ data.tar.gz: 44ddb40ca20348587b194c7d4a36f6cf8b2f7ed971bd22a04824532388adb56b90e8448336a641c49d97f35f754042444a60d5aee2acb17b44505d8fb42ad055
data/bin/topinambour CHANGED
@@ -46,6 +46,7 @@ end
46
46
  resource = Gio::Resource.load(gresource_bin)
47
47
  Gio::Resources.register(resource)
48
48
  # Load default libraries !!WARNING!! loading order matters
49
+ #%w(actions style_properties css_handler application terminal_regex terminal notebook color_selector font_selector
49
50
  %w(actions style_properties css_handler application terminal notebook color_selector font_selector
50
51
  terminal_chooser headerbar shortcuts window resize_message css_editor).each do |l|
51
52
  if File.exist?("#{USR_LIB_PATH}/#{l}.rb")
data/lib/headerbar.rb CHANGED
@@ -37,12 +37,12 @@ SECTOOLTIP
37
37
 
38
38
  def self.generate_current_label_signals(label, window)
39
39
  label.signal_connect "activate" do |entry|
40
- window.notebook.current.tab_label = entry.text
40
+ window.notebook.current.custom_title = entry.text
41
41
  end
42
42
 
43
43
  label.signal_connect "icon-release" do |entry, position|
44
44
  if position == :secondary
45
- window.notebook.current.tab_label = nil
45
+ window.notebook.current.custom_title = nil
46
46
  entry.text = window.notebook.current.window_title
47
47
  end
48
48
  end
data/lib/notebook.rb CHANGED
@@ -27,7 +27,7 @@ class TopinambourNotebook < Gtk::Notebook
27
27
  end
28
28
 
29
29
  signal_connect "switch-page" do |_widget, next_page, next_page_num|
30
- toplevel.current_label.text = next_page.tab_label || get_tab_label(next_page).text
30
+ toplevel.current_label.text = next_page.terminal_title
31
31
  toplevel.current_tab.text = "#{next_page_num + 1}/#{n_pages}"
32
32
 
33
33
  if page >= 0 && @gen_preview
@@ -66,6 +66,38 @@ DEFAULT_TERMINAL_COLORS = %w(#aeafad #323232 #000000 #b9214f #A6E22E #ff9800
66
66
  )
67
67
  DEFAULT_TERMINAL_FONT = "Monospace 11"
68
68
 
69
+ # boolean :
70
+ #
71
+ # audible_bell
72
+ # allow_bold
73
+ # scroll_on_output
74
+ # scroll_on_keystroke
75
+ # rewrap_on_resize
76
+ # mouse_autohide
77
+ #
78
+ # VteCursorShape :
79
+ # cursor_shape
80
+ # VTE_CURSOR_SHAPE_BLOCK Draw a block cursor. This is the default.
81
+ # VTE_CURSOR_SHAPE_IBEAM Draw a vertical bar on the left side of character.
82
+ # This is similar to the default cursor for other GTK+ widgets.
83
+ # VTE_CURSOR_SHAPE_UNDERLINE Draw a horizontal bar below the character.
84
+ #
85
+ # VteCursorBlinkMode
86
+ # cursor_blink_mode
87
+ # VTE_CURSOR_BLINK_SYSTEM Follow GTK+ settings for cursor blinking.
88
+ # VTE_CURSOR_BLINK_ON Cursor blinks.
89
+ # VTE_CURSOR_BLINK_OFF Cursor does not blink.
90
+ #
91
+ # VteEraseBinding
92
+ # backspace_binding
93
+ # delete_binding
94
+ # VTE_ERASE_AUTO For backspace, attempt to determine the right value from the
95
+ # terminal's IO settings. For delete, use the control sequence.
96
+ # VTE_ERASE_ASCII_BACKSPACE Send an ASCII backspace character (0x08).
97
+ # VTE_ERASE_ASCII_DELETE Send an ASCII delete character (0x7F).
98
+ # VTE_ERASE_DELETE_SEQUENCE Send the "@7 " control sequence.
99
+ # VTE_ERASE_TTY Send terminal's "erase" setting.
100
+
69
101
  class TopinambourTerminal < Vte::Terminal
70
102
  extend TopinambourStyleProperties
71
103
  type_register
data/lib/terminal.rb CHANGED
@@ -18,7 +18,7 @@
18
18
  # The default vte terminal customized
19
19
  class TopinambourTerminal
20
20
  attr_reader :pid, :menu
21
- attr_accessor :preview, :colors, :tab_label
21
+ attr_accessor :preview, :colors, :custom_title
22
22
 
23
23
  ##
24
24
  # Create a new TopinambourTerminal instance that runs command_string
@@ -85,6 +85,10 @@ class TopinambourTerminal
85
85
  set_colors(@colors[0], @colors[1], @colors[2..-1])
86
86
  end
87
87
 
88
+ def terminal_title
89
+ @custom_title.class == String ? @custom_title : window_title.to_s
90
+ end
91
+
88
92
  private
89
93
 
90
94
  def parse_css_color(color_name)
@@ -130,11 +134,7 @@ class TopinambourTerminal
130
134
  _match, _regex_type = match_check_event(event)
131
135
  end
132
136
 
133
- def current_terminal_title
134
- @tab_label.class == String ? @tab_label : window_title
135
- end
136
-
137
137
  def when_terminal_title_change
138
- parent.toplevel.current_label.text = current_terminal_title
138
+ parent.toplevel.current_label.text = terminal_title
139
139
  end
140
140
  end
@@ -0,0 +1,99 @@
1
+ # Copyright 2016 Cédric LE MOIGNE, cedlemo@gmx.com
2
+ # This file is part of Topinambour.
3
+ #
4
+ # Topinambour is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # any later version.
8
+ #
9
+ # Topinambour is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ # Stolen from https://github.com/GNOME/gnome-terminal/blob/master/src/terminal-regex.h
18
+ module TopinambourRegex
19
+ SCHEME = "(?ix: news | telnet | nntp | https? | ftps? | sftp | webcal )"
20
+ USERCHARS = "-+.[:alnum:]"
21
+ # Nonempty username, e.g. "john.smith"
22
+ USER = "[#{USERCHARS}]+"
23
+ PASSCHARS_CLASS = '[-[:alnum:]\\Q,?;.:/!%$^*&~\"#\'\\E]'
24
+ # Optional colon-prefixed password. I guess empty password should be allowed, right? E.g. ":secret", ":", "" */
25
+ PASS = "(?x: :#{PASSCHARS_CLASS}* )?"
26
+ # Optional at-terminated username (with perhaps a password too), e.g. "joe@", "pete:secret@", "" */
27
+ USERPASS = "(?:#{USER}#{PASS}@)?"
28
+ # S4: IPv4 segment (number between 0 and 255) with lookahead at the end so that we don't match "25" in the string "256".
29
+ # The lookahead could go to the last segment of IPv4 only but this construct allows nicer unittesting. */
30
+ S4_DEF = "(?(DEFINE)(?<S4>(?x: (?: [0-9] | [1-9][0-9] | 1[0-9]{2} | 2[0-4][0-9] | 25[0-5] ) (?! [0-9] ) )))"
31
+ # IPV4: Decimal IPv4, e.g. "1.2.3.4", with lookahead (implemented in S4) at the end so that we don't match "192.168.1.123" in the string "192.168.1.1234". */
32
+ IPV4_DEF = "#{S4_DEF}(?(DEFINE)(?<IPV4>(?x: (?: (?&S4) \\. ){3} (?&S4) )))"
33
+ # IPv6, including embedded IPv4, e.g. "::1", "dead:beef::1.2.3.4".
34
+ # Lookahead for the next char not being a dot or digit, so it doesn't get stuck matching "dead:beef::1" in "dead:beef::1.2.3.4".
35
+ # This is not required since the surrounding brackets would trigger backtracking, but it allows nicer unittesting.
36
+ # TODO: more strict check (right number of colons, etc.)
37
+ # TODO: add zone_id: RFC 4007 section 11, RFC 6874 */
38
+ # S6: IPv6 segment, S6C: IPv6 segment followed by a comma, CS6: comma followed by an IPv6 segment */
39
+ S6_DEF = "(?(DEFINE)(?<S6>[[:xdigit:]]{1,4})(?<CS6>:(?&S6))(?<S6C>(?&S6):))"
40
+ # No :: shorthand */
41
+ IPV6_FULL = "(?x: (?&S6C){7} (?&S6) )"
42
+ # Begins with :: */
43
+ IPV6_LEFT = "(?x: : (?&CS6){1,7} )"
44
+ # :: somewhere in the middle - use negative lookahead to make sure there aren't too many colons in total */
45
+ IPV6_MID = "(?x: (?! (?: [[:xdigit:]]*: ){8} ) (?&S6C){1,6} (?&CS6){1,6} )"
46
+ # Ends with :: */
47
+ IPV6_RIGHT = "(?x: (?&S6C){1,7} : )"
48
+ # Is "::" and nothing more */
49
+ IPV6_NULL = "(?x: :: )"
50
+ # The same ones for IPv4-embedded notation, without the actual IPv4 part */
51
+ IPV6V4_FULL = "(?x: (?&S6C){6} )"
52
+ IPV6V4_LEFT = "(?x: :: (?&S6C){0,5} )" # includes "::<ipv4>" */
53
+ IPV6V4_MID = "(?x: (?! (?: [[:xdigit:]]*: ){7} ) (?&S6C){1,4} (?&CS6){1,4} ) :"
54
+ IPV6V4_RIGHT = "(?x: (?&S6C){1,5} : )"
55
+ # IPV6: An IPv6 address (possibly with an embedded IPv4).
56
+ # This macro defines both IPV4 and IPV6, since the latter one requires the former. */
57
+ IP_DEF = "#{IPV4_DEF}#{S6_DEF}(?(DEFINE)(?<IPV6>(?x: (?: #{IPV6_NULL} | #{IPV6_LEFT} | #{IPV6_MID} | #{IPV6_RIGHT} \
58
+ | #{IPV6_FULL} | (?: #{IPV6V4_FULL} | #{IPV6V4_LEFT} | #{IPV6V4_MID} | #{IPV6V4_RIGHT} \
59
+ ) (?&IPV4) ) (?! [.:[:xdigit:]] ) )))"
60
+ # Either an alphanumeric character or dash; or if [negative lookahead] not ASCII
61
+ # then any graphical Unicode character.
62
+ # A segment can consist entirely of numbers.
63
+ # (Note: PCRE doesn't support character class subtraction/intersection.) */
64
+ HOSTNAMESEGMENTCHARS_CLASS = "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )"
65
+ # A hostname of at least 1 component. The last component cannot be entirely numbers.
66
+ # E.g. "foo", "example.com", "1234.com", but not "foo.123" */
67
+ HOSTNAME1 = "(?x: (?: #{HOSTNAMESEGMENTCHARS_CLASS}+ \\. )* " + "#{HOSTNAMESEGMENTCHARS_CLASS}* (?! [0-9] ) #{HOSTNAMESEGMENTCHARS_CLASS}+ )"
68
+ # A hostname of at least 2 components. The last component cannot be entirely numbers.
69
+ # E.g. "example.com", "1234.com", but not "1234.56" */
70
+ HOSTNAME2 = "(?x: (?: #{HOSTNAMESEGMENTCHARS_CLASS}+ \\.)+ #{HOSTNAME1} )"
71
+ # For URL: Hostname, IPv4, or bracket-enclosed IPv6, e.g. "example.com", "1.2.3.4", "[::1]" */
72
+ URL_HOST = "(?x: #{HOSTNAME1} | (?&IPV4) | \\[ (?&IPV6) \\] )"
73
+ # For e-mail: Hostname of at least two segments, or bracket-enclosed IPv4 or IPv6, e.g. "example.com", "[1.2.3.4]", "[::1]".
74
+ # Technically an e-mail with a single-component hostname might be valid on a local network,
75
+ # but let's avoid tons of false positives (e.g. in a typical shell prompt). */
76
+ EMAIL_HOST = "(?x: #{HOSTNAME2} | \\[ (?: (?&IPV4) | (?&IPV6) ) \\] )"
77
+ # Number between 1 and 65535, with lookahead at the end so that we don't match "6789" in the string "67890",
78
+ # and in turn we don't eventually match "http://host:6789" in "http://host:67890". */
79
+ N_1_65535 = "(?x: (?: [1-9][0-9]{0,3} | [1-5][0-9]{4} | 6[0-4][0-9]{3} | 65[0-4][0-9]{2} | 655[0-2][0-9] | 6553[0-5] ) (?! [0-9] ) )"
80
+ # Optional colon-prefixed port, e.g. ":1080", "" */
81
+ PORT = "(?x: \\:#{N_1_65535} )?"
82
+ PATHCHARS_CLASS = "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
83
+ # Chars not to end a URL */
84
+ PATHNONTERM_CLASS = "[\\Q.!,?\\E]"
85
+ # Lookbehind at the end, so that the last character (if we matched a character at all) is not from PATHTERM_CLASS */
86
+ URLPATH = "(?x: /#{PATHCHARS_CLASS}* (?<! #{PATHNONTERM_CLASS} ) )?"
87
+ VOIP_PATH = "(?x: [;?]#{PATHCHARS_CLASS}* (?<! #{PATHNONTERM_CLASS} ) )?"
88
+ # Now let's put these fragments together */
89
+ DEFS = IP_DEF
90
+ REGEX_URL_AS_IS = "#{DEFS}#{SCHEME}://#{USERPASS}#{URL_HOST}#{PORT}#{URLPATH}"
91
+ # TODO: also support file:/etc/passwd */
92
+ REGEX_URL_FILE = "#{DEFS}(?ix: file:/ (?: / (?: #{HOSTNAME1} )? / )? (?! / ) )(?x: #{PATHCHARS_CLASS}+ (?<! #{PATHNONTERM_CLASS} ) )?"
93
+ # Lookbehind so that we don't catch "abc.www.foo.bar", bug 739757.
94
+ # Lookahead for www/ftp for convenience (so that we can reuse HOSTNAME1). */
95
+ REGEX_URL_HTTP = "#{DEFS}(?<!(?:#{HOSTNAMESEGMENTCHARS_CLASS}|[.]))(?=(?i:www|ftp))#{HOSTNAME1}#{PORT}#{URLPATH}"
96
+ REGEX_URL_VOIP = "#{DEFS}(?i:h323:|sips?:)#{USERPASS}#{URL_HOST}#{PORT}#{VOIP_PATH}"
97
+ REGEX_EMAIL = "#{DEFS}(?i:mailto:)?#{USER}@#{EMAIL_HOST}"
98
+ REGEX_NEWS_MAN = "(?i:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"
99
+ end
data/lib/window.rb CHANGED
@@ -53,7 +53,7 @@ class TopinambourWindow
53
53
  add_resize_timeout
54
54
  end
55
55
  end
56
- @notebook.append_page(terminal, Gtk::Label.new)
56
+ @notebook.append_page(terminal)
57
57
  @notebook.set_tab_reorderable(terminal, true)
58
58
  @notebook.set_page(@notebook.n_pages - 1)
59
59
  @notebook.current.grab_focus
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topinambour
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cédric LE MOIGNE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -113,6 +113,7 @@ files:
113
113
  - lib/style_properties.rb
114
114
  - lib/terminal.rb
115
115
  - lib/terminal_chooser.rb
116
+ - lib/terminal_regex.rb
116
117
  - lib/window.rb
117
118
  homepage: https://github.com/cedlemo/topinambour
118
119
  licenses: