vimmate 0.8.1

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.
Files changed (85) hide show
  1. data/.autotest +10 -0
  2. data/CHANGELOG +108 -0
  3. data/COPYING +20 -0
  4. data/README +221 -0
  5. data/Rakefile +31 -0
  6. data/TODO +21 -0
  7. data/bin/vimmate +105 -0
  8. data/config/environment.rb +35 -0
  9. data/controllers/file_filter_controller.rb +101 -0
  10. data/controllers/file_popup_menu_controller.rb +40 -0
  11. data/controllers/vim_controller.rb +28 -0
  12. data/controllers/vim_mate_controller.rb +76 -0
  13. data/images/file.png +0 -0
  14. data/images/file_green.png +0 -0
  15. data/images/file_orange.png +0 -0
  16. data/images/file_red.png +0 -0
  17. data/images/folder.png +0 -0
  18. data/images/folder_green.png +0 -0
  19. data/images/folder_orange.png +0 -0
  20. data/images/folder_red.png +0 -0
  21. data/images/processing.png +0 -0
  22. data/images/svn_added.png +0 -0
  23. data/images/svn_conflict.png +0 -0
  24. data/images/svn_deleted.png +0 -0
  25. data/images/svn_locked.png +0 -0
  26. data/images/svn_modified.png +0 -0
  27. data/images/svn_normal.png +0 -0
  28. data/images/svn_readonly.png +0 -0
  29. data/images/vimmate16.png +0 -0
  30. data/images/vimmate32.png +0 -0
  31. data/images/vimmate48.png +0 -0
  32. data/lib/active_window/active_column.rb +218 -0
  33. data/lib/active_window/active_tree_store/columns.rb +88 -0
  34. data/lib/active_window/active_tree_store/extentions.rb +81 -0
  35. data/lib/active_window/active_tree_store/index.rb +53 -0
  36. data/lib/active_window/active_tree_store.rb +26 -0
  37. data/lib/active_window/application.rb +137 -0
  38. data/lib/active_window/controller.rb +58 -0
  39. data/lib/active_window/dot_file.rb +29 -0
  40. data/lib/active_window/filtered_active_tree_store.rb +113 -0
  41. data/lib/active_window/listed_item.rb +127 -0
  42. data/lib/active_window/signal.rb +46 -0
  43. data/lib/active_window.rb +8 -0
  44. data/lib/config_window.rb +90 -0
  45. data/lib/file_tree_store.rb +74 -0
  46. data/lib/filtered_file_tree_store.rb +34 -0
  47. data/lib/gtk_thread_helper.rb +73 -0
  48. data/lib/listed_directory.rb +45 -0
  49. data/lib/listed_file.rb +67 -0
  50. data/lib/try.rb +9 -0
  51. data/lib/vim/buffers.rb +18 -0
  52. data/lib/vim/integration.rb +38 -0
  53. data/lib/vim/netbeans.rb +154 -0
  54. data/lib/vim/source.vim +18 -0
  55. data/lib/vim_mate/config.rb +132 -0
  56. data/lib/vim_mate/dummy_window.rb +14 -0
  57. data/lib/vim_mate/files_menu.rb +110 -0
  58. data/lib/vim_mate/icons.rb +156 -0
  59. data/lib/vim_mate/nice_singleton.rb +53 -0
  60. data/lib/vim_mate/plugins/inotify/init.rb +4 -0
  61. data/lib/vim_mate/plugins/inotify/lib/INotify.rb +208 -0
  62. data/lib/vim_mate/plugins/inotify/lib/directory.rb +58 -0
  63. data/lib/vim_mate/plugins/subversion/init.rb +7 -0
  64. data/lib/vim_mate/plugins/subversion/lib/file.rb +59 -0
  65. data/lib/vim_mate/plugins/subversion/lib/menu.rb +96 -0
  66. data/lib/vim_mate/plugins/subversion/lib/subversion.rb +157 -0
  67. data/lib/vim_mate/plugins.rb +6 -0
  68. data/lib/vim_mate/requirer.rb +68 -0
  69. data/lib/vim_mate/search_window.rb +227 -0
  70. data/lib/vim_mate/tags_window.rb +167 -0
  71. data/lib/vim_mate/terminals_window.rb +163 -0
  72. data/lib/vim_mate/version.rb +29 -0
  73. data/lib/vim_mate/vim_widget.rb +143 -0
  74. data/spec/active_window/active_column_spec.rb +41 -0
  75. data/spec/active_window/active_tree_store_spec.rb +312 -0
  76. data/spec/active_window/controller_spec.rb +6 -0
  77. data/spec/lib/file_tree_store_spec.rb +40 -0
  78. data/spec/lib/listed_directory_spec.rb +26 -0
  79. data/spec/lib/listed_file_spec.rb +53 -0
  80. data/spec/nice_singleton_spec.rb +23 -0
  81. data/spec/spec.opts +6 -0
  82. data/spec/spec_helper.rb +10 -0
  83. data/views/vim_mate.glade +500 -0
  84. data/vimmate.gemspec +138 -0
  85. metadata +146 -0
@@ -0,0 +1,167 @@
1
+ =begin
2
+ = VimMate: Vim graphical add-on
3
+ Copyright (c) 2006 Guillaume Benny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ =end
23
+
24
+ module VimMate
25
+
26
+ class TagsWindow
27
+
28
+ #treestore columns
29
+ # Column for the tag name
30
+ NAME = 0
31
+ # Column for the line it is in
32
+ LINE = 1
33
+ PATH = 2
34
+
35
+ #path_node_connection columns
36
+ NODE = 0
37
+ METHODS = 1
38
+ CLASSES = 2
39
+
40
+ def add_parent_rows(paths)
41
+ #add some parents
42
+ @path_node_connection = Hash.new(false)
43
+ paths.each do |path|
44
+ node = @tags_treestore.append(nil)
45
+ node[0] = path.split('/').last
46
+ node[1] = ''
47
+ node[2] = ''
48
+ methods = @tags_treestore.append(node)
49
+ methods[0] = 'Methods'
50
+ methods[1] = ''
51
+ methods[2] = ''
52
+ classes = @tags_treestore.append(node)
53
+ classes[0] = 'Classes'
54
+ classes[1] = ''
55
+ classes[2] = ''
56
+ @path_node_connection[path] = [node, methods, classes]
57
+ end
58
+ end
59
+
60
+ def initialize(vim_window = FalseClass)
61
+ @vim_window = vim_window
62
+ @tags_treestore = Gtk::TreeStore.new(String,String,String)
63
+
64
+ # Tree View
65
+ @tags_tree_view = Gtk::TreeView.new(@tags_treestore)
66
+ @tags_tree_view.selection.mode = Gtk::SELECTION_SINGLE
67
+ @tags_tree_view.headers_visible = Config[:file_headers_visible]
68
+ @tags_tree_view.hover_selection = Config[:file_hover_selection]
69
+
70
+ tags_renderer = Gtk::CellRendererText.new
71
+ col = Gtk::TreeViewColumn.new("Identifier", tags_renderer, :text => NAME)
72
+ @tags_tree_view.append_column(col)
73
+ col = Gtk::TreeViewColumn.new("Line", tags_renderer, :text => LINE)
74
+ @tags_tree_view.append_column(col)
75
+
76
+ # Double-click, Enter, Space: Signal to open the file
77
+ @tags_tree_view.signal_connect("row-activated") do |view, path, column|
78
+ iter = @tags_treestore.get_iter(path)
79
+ @vim_window.open_and_jump_to_line iter[PATH], iter[LINE].to_i
80
+ end
81
+
82
+ Signal.on_file_opened do |path|
83
+ sleep 0.5
84
+ do_refresh_tags
85
+ end
86
+
87
+ #@tags_text_buffer = Gtk::TextBuffer.new()
88
+ #gtk_text_view = Gtk::TextView.new(@tags_text_buffer)
89
+ #gtk_text_view.editable = false
90
+ #gtk_text_view.cursor_visible = false
91
+
92
+ # Set the default size for the file list
93
+
94
+ Signal.on_file_modified do |path|
95
+ paths = @vim_window.get_all_buffer_paths
96
+ if paths.include?(path)
97
+ do_refresh_tags
98
+ end
99
+ end
100
+
101
+ #Signal.on_file_deleted do |path|
102
+ # #do_refresh_tags
103
+ #end
104
+
105
+ #Signal.on_file_created do |path|
106
+ # #do_refresh_tags
107
+ #end
108
+ end
109
+
110
+ # The "window" for this object
111
+ def gtk_window
112
+ @tags_tree_view
113
+ end
114
+
115
+ #TODO:
116
+ #refresh upon switch to this tab:
117
+ #switch-page: self, page, page_num
118
+ #Emitted when the user or a function changes the current page.
119
+ #
120
+ # * self: the object which received the signal.
121
+ # * page: the new current Gtk::NotebookPage
122
+ # * page_num: the index of the page
123
+
124
+ def do_refresh_tags(paths=nil)
125
+ if not paths
126
+ paths = @vim_window.get_all_buffer_paths
127
+ end
128
+
129
+ @tags_treestore.clear
130
+ add_parent_rows(paths)
131
+
132
+ paths.each do |path|
133
+ #TODO make me dependent/configurable on file type/suffix
134
+ tags = `ctags --sort=1 -ex #{path}`
135
+ last_class = nil
136
+
137
+ whats_a_tag = %r[^(\w+)\s+(\w+\s?\w+)\s+(\d+)\s+(\S+)]
138
+ tags.each_line do |tag|
139
+ if elems = whats_a_tag.match(tag)
140
+ id, type, line, file = elems[1..-1]
141
+ case type
142
+ when 'function'
143
+ new_row = @tags_treestore.append(@path_node_connection[path][METHODS])
144
+ new_row.set_value(NAME, id)
145
+ new_row.set_value(LINE, line)
146
+ new_row.set_value(PATH, file)
147
+ when 'class'
148
+ new_row = @tags_treestore.append(@path_node_connection[path][CLASSES])
149
+ new_row.set_value(NAME, id)
150
+ new_row.set_value(LINE, line)
151
+ new_row.set_value(PATH, file)
152
+ last_class = new_row
153
+ when /^(singleton )?method|member$/
154
+ new_row = @tags_treestore.append(last_class)
155
+ new_row.set_value(NAME, id)
156
+ new_row.set_value(LINE, line)
157
+ new_row.set_value(PATH, file)
158
+ end
159
+ end
160
+ end
161
+ end
162
+
163
+ @tags_tree_view.expand_all
164
+ end
165
+ end
166
+
167
+ end
@@ -0,0 +1,163 @@
1
+ =begin
2
+ = VimMate: Vim graphical add-on
3
+ Copyright (c) 2006 Guillaume Benny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ =end
23
+
24
+ require 'set'
25
+ require 'vte'
26
+
27
+ module VimMate
28
+
29
+ # Do not load the terminals if they are disabled
30
+ Requirer.raise_load_error_if do
31
+ not Config[:terminals_enabled]
32
+ end
33
+
34
+ class ::Vte::Terminal
35
+ attr_accessor :pid
36
+ end
37
+
38
+ # The window that contains the terminals
39
+ class TerminalsWindow
40
+
41
+ # Create a TerminalsWindow
42
+ def initialize
43
+ @expander_signal = Set.new
44
+
45
+ # Create the tabbed page
46
+ @gtk_notebook = Gtk::Notebook.new
47
+ @gtk_notebook.scrollable = true
48
+ # Add a terminal at startup
49
+ @gtk_notebook.append_page(new_terminal)
50
+ # The last page is just an icon to create new tabs
51
+ @gtk_notebook.append_page(Gtk::EventBox.new,
52
+ Gtk::Image.new(Gtk::Stock::NEW, Gtk::IconSize::MENU))
53
+ # When we try to go to the last page, we create a new terminal instead
54
+ @gtk_notebook.signal_connect_after("switch-page") do |notebook, page, page_num|
55
+ add_new_terminal if page_num == (@gtk_notebook.n_pages - 1)
56
+ end
57
+ @gtk_notebook.set_size_request(0, Config[:terminals_height])
58
+ end
59
+
60
+ # The "window" for this object
61
+ def gtk_window
62
+ @gtk_notebook
63
+ end
64
+
65
+ # Add a block that will be called when the user choose to expand or
66
+ # close the expander. The block takes one argument: if the expander
67
+ # is opened or closed
68
+ def add_expander_signal(&block)
69
+ @expander_signal << block
70
+ end
71
+
72
+ # Set the focus to the current terminal
73
+ def focus_terminal
74
+ page = @gtk_notebook.get_nth_page(@gtk_notebook.page)
75
+ page.has_focus = true if page
76
+ end
77
+
78
+ # Add a new terminal at the left of the tab bar.
79
+ def add_new_terminal
80
+ page_num = @gtk_notebook.n_pages - 1
81
+ @gtk_notebook.insert_page(page_num, new_terminal)
82
+ @gtk_notebook.page = page_num
83
+ end
84
+
85
+ # Deletes terminal with number *page_num*, defaults to current page number.
86
+ def delete_current_terminal
87
+ page = @gtk_notebook.get_nth_page(@gtk_notebook.page)
88
+ prev_terminal
89
+ Process.kill 'HUP', page.pid
90
+ end
91
+
92
+ # Switch the next (right) terminal, if there exists one. Otherwise start
93
+ # again with the first terminal on the left.
94
+ def next_terminal
95
+ if @gtk_notebook.page < @gtk_notebook.n_pages - 2
96
+ @gtk_notebook.next_page
97
+ else
98
+ @gtk_notebook.page = 0
99
+ end
100
+ end
101
+
102
+ # Switch the previous (left) terminal, if there exists one. Otherwise start
103
+ # with again with the last terminal on the right.
104
+ def prev_terminal
105
+ if @gtk_notebook.page > 0
106
+ @gtk_notebook.prev_page
107
+ else
108
+ @gtk_notebook.page = @gtk_notebook.n_pages - 2
109
+ end
110
+ end
111
+
112
+ private
113
+
114
+ # Create a new terminal and return it
115
+ def new_terminal
116
+ # Setup of the terminal
117
+ gtk_terminal = Vte::Terminal.new
118
+ gtk_terminal.audible_bell = Config[:terminals_audible_bell]
119
+ gtk_terminal.visible_bell = Config[:terminals_visible_bell]
120
+ gtk_terminal.set_font(Config[:terminals_font])
121
+ forecolor = Gdk::Color.parse(Config[:terminals_foreground_color])
122
+ backcolor = Gdk::Color.parse(Config[:terminals_background_color])
123
+ gtk_terminal.set_colors(forecolor, backcolor, [])
124
+
125
+ # Hide and destroy the terminal when the shell exits
126
+ gtk_terminal.signal_connect("child-exited") do |terminal|
127
+ break if @gtk_notebook.destroyed?
128
+ # Select the page before
129
+ page_num = @gtk_notebook.page_num(terminal)
130
+ if page_num == 0
131
+ @gtk_notebook.page = 0
132
+ else
133
+ @gtk_notebook.page = page_num - 1
134
+ end
135
+ # Hide it and destroy it after a while
136
+ terminal.hide
137
+ Thread.new do
138
+ sleep(5)
139
+ terminal.destroy unless terminal.destroyed?
140
+ end
141
+ end
142
+ # When the title of the terminal changes, set the name of the page
143
+ gtk_terminal.signal_connect("window-title-changed") do |terminal|
144
+ @gtk_notebook.set_tab_label_text(terminal, terminal.window_title)
145
+ end
146
+ if (Config[:terminals_login_shell])
147
+ begin
148
+ require 'etc'
149
+ rescue LoadError
150
+ end
151
+ shell = (ENV["SHELL"] || Etc.getpwnam(Etc.getlogin).shell rescue nil || "/bin/sh")
152
+ gtk_terminal.pid = gtk_terminal.fork_command(shell, ["-l"])
153
+ else
154
+ gtk_terminal.pid = gtk_terminal.fork_command
155
+ end
156
+ gtk_terminal.feed_child(Config[:terminals_autoexec])
157
+ gtk_terminal.show
158
+ gtk_terminal
159
+ end
160
+
161
+ end
162
+ end
163
+
@@ -0,0 +1,29 @@
1
+ =begin
2
+ = VimMate: Vim graphical add-on
3
+ Copyright (c) 2006 Guillaume Benny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ =end
23
+
24
+ module VimMate
25
+
26
+ # VimMate's version
27
+ VERSION = "0.6.6"
28
+ end
29
+
@@ -0,0 +1,143 @@
1
+ =begin
2
+ = VimMate: Vim graphical add-on
3
+ Copyright (c) 2006 Guillaume Benny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ =end
23
+
24
+
25
+ module VimMate
26
+
27
+ # A window that can display and send information to the
28
+ # GTK GUI of Vim (gVim)
29
+ class VimWidget
30
+
31
+ include Vim::Integration
32
+
33
+ # Create the VimWindow. You must call start after this window is visible
34
+ def initialize
35
+ # A unique Vim server name
36
+ @vim_server_name = "VimMate_#{Process.pid}"
37
+ @gtk_socket = Gtk::Socket.new
38
+ @gtk_socket.show_all
39
+ @gtk_socket.signal_connect("delete_event") do
40
+ false
41
+ end
42
+ @gtk_socket.signal_connect("destroy") do
43
+ Gtk.main_quit
44
+ end
45
+ @gtk_socket.can_focus = true
46
+ @gtk_socket.has_focus = true
47
+ @vim_started = false
48
+ end
49
+
50
+ # The "window" for this object
51
+ def window
52
+ @gtk_socket
53
+ end
54
+
55
+ def extras_source_path
56
+ File.join( File.dirname(__FILE__), '..', 'vim', 'source.vim')
57
+ end
58
+
59
+ # Open the specified file in Vim
60
+ def open(path, kind = :open)
61
+ start
62
+ path = path.gsub "'", "\\'"
63
+ case kind
64
+ when :split
65
+ remote_send '<ESC><ESC><ESC>:split<CR>'
66
+ exec_gvim "--remote '#{path}'"
67
+ when :open, :split
68
+ exec_gvim "--remote '#{path}'"
69
+ when :tab
70
+ exec_gvim "--remote-tab '#{path}'"
71
+ else
72
+ raise "Unknow open kind: #{kind}"
73
+ end
74
+ remote_send "<ESC><ESC><ESC>:buffer #{path}<CR>"
75
+ focus!
76
+ #Signal.emit_file_opened(path)
77
+ self
78
+ end
79
+
80
+ def open_and_jump_to_line(path,lnum)
81
+ unless buffer = buffers.index(path)
82
+ open path, Config[:files_default_open_in_tabs] ? :tab_open : :open
83
+ sleep 0.5
84
+ end
85
+ send_command buffer, 'setDot', [lnum,0]
86
+ focus!
87
+ self
88
+ end
89
+
90
+ def jump_to_line(line)
91
+ start
92
+ if line >= 0
93
+ # TODO use neatbeans
94
+ remote_send "<ESC><ESC><ESC>:#{line}<CR>"
95
+ end
96
+ end
97
+
98
+ # Start Vim's window. This must be called after the window which
99
+ # will contain Vim is visible.
100
+ def start
101
+ return if @vim_started
102
+ return unless @gtk_socket
103
+ @vim_started = true
104
+ listen
105
+ fork do
106
+ exec %Q[#{Executable} --servername #{@vim_server_name} --socketid #{@gtk_socket.id} -nb:localhost:#{port}:#{Password} -S #{extras_source_path}]
107
+ end
108
+ self
109
+ end
110
+
111
+ # Set the focus to Vim
112
+ def focus!
113
+ @gtk_socket.can_focus = true
114
+ @gtk_socket.has_focus = true
115
+ end
116
+
117
+ def get_current_buffer_path
118
+ if @vim_started
119
+ #`gvim --servername #{@vim_server_name} --remote-send ':redir! > outputfile<cr>'`
120
+ #`gvim --servername #{@vim_server_name} --remote-send ':echo getcwd()<cr>'`
121
+ #`gvim --servername #{@vim_server_name} --remote-send ':echo bufname(bufnr(""))<cr>'`
122
+ #`gvim --servername #{@vim_server_name} --remote-send ':redir END<cr>'`
123
+
124
+ get_current_buffer_number
125
+
126
+ cwd = exec_gvim "--remote-expr 'getcwd()'".chomp+'/'
127
+ if cwd
128
+ return cwd + exec_gvim(%Q~--remote-expr 'bufname(bufnr(""))'~)
129
+ end
130
+ end
131
+ end
132
+
133
+ def get_current_buffer_number
134
+ send_function('getCursor')
135
+ end
136
+
137
+ def get_all_buffer_paths
138
+ buffers[1..-1]
139
+ end
140
+
141
+ end
142
+ end
143
+
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe ActiveWindow::ActiveColumn do
4
+ before( :each ) do
5
+ @class = ActiveWindow::ActiveColumn
6
+ end
7
+
8
+ it "shold be a Class" do
9
+ @class.should be_a(Class)
10
+ end
11
+
12
+ shared_examples_for "any column" do
13
+ it "should be a ActiveColumn" do
14
+ @col.should be_a(ActiveWindow::ActiveColumn)
15
+ end
16
+
17
+ it "should have a view" do
18
+ @col.view.should_not be_nil
19
+ end
20
+
21
+ end
22
+
23
+ describe "of type String" do
24
+ before( :each ) do
25
+ @col = @class.create(0,'name', :string)
26
+ end
27
+ it_should_behave_like 'any column'
28
+
29
+ it "should be a ActiveTextColumn" do
30
+ @col.should be_a(ActiveWindow::ActiveTextColumn)
31
+ end
32
+
33
+ it "should take a String" do
34
+ @col.data_class.should == String
35
+ end
36
+
37
+
38
+
39
+ end
40
+
41
+ end