redcar 0.11.0dev → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +14 -1
- data/README.md +28 -8
- data/Rakefile +23 -18
- data/bin/redcar +9 -4
- data/lib/redcar.rb +42 -4
- data/lib/redcar/installer.rb +7 -2
- data/lib/redcar/logger.rb +64 -0
- data/lib/redcar/runner.rb +17 -8
- data/lib/redcar/usage.rb +2 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +4 -4
- data/plugins/application/features/support/env.rb +6 -6
- data/plugins/application/lib/application.rb +31 -3
- data/plugins/application/lib/application/command.rb +6 -0
- data/plugins/application/lib/application/command/executor.rb +0 -1
- data/plugins/application/lib/application/commands/application_commands.rb +21 -0
- data/plugins/application/lib/application/commands/notebook_commands.rb +73 -0
- data/plugins/application/lib/application/commands/tab_commands.rb +105 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +117 -0
- data/plugins/application/lib/application/commands/window_commands.rb +68 -0
- data/plugins/{tree/lib → application/lib/application}/tree.rb +0 -4
- data/plugins/{tree/lib → application/lib/application}/tree/command.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/controller.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/mirror.rb +0 -0
- data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/builder_spec.rb +2 -2
- data/plugins/application_swt/lib/application_swt.rb +4 -2
- data/plugins/application_swt/lib/swt/vtab_label.rb +6 -3
- data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +6 -3
- data/plugins/clojure/lib/clojure.rb +2 -2
- data/plugins/core/lib/core.rb +0 -4
- data/plugins/core/lib/core/gui.rb +2 -4
- data/plugins/core/lib/core/plugin/storage.rb +68 -21
- data/plugins/core/spec/core/base_storage_spec.rb +81 -0
- data/plugins/core/spec/core/shared_storage_spec.rb +49 -0
- data/plugins/core/spec/core/storage_spec.rb +13 -63
- data/plugins/declarations/lib/declarations.rb +3 -1
- data/plugins/document_search/features/replace.feature +29 -20
- data/plugins/document_search/lib/document_search/find_speedbar.rb +4 -1
- data/plugins/edit_view/features/indentation_commands.feature +6 -5
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +4 -4
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +7 -7
- data/plugins/edit_view/features/step_definitions/window_steps.rb +2 -2
- data/plugins/edit_view/lib/edit_view.rb +15 -1
- data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +7 -7
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +7 -6
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +1 -1
- data/plugins/groovy/lib/groovy.rb +3 -3
- data/plugins/groovy/lib/groovy/commands.rb +1 -1
- data/plugins/help/lib/help/view_controller.rb +5 -0
- data/plugins/help/views/index.html.erb +10 -1
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +1 -1
- data/plugins/html_view/features/support/env.rb +0 -15
- data/plugins/html_view/lib/html_view.rb +3 -4
- data/plugins/html_view/lib/html_view/commands.rb +1 -1
- data/plugins/key_bindings/lib/key_bindings.rb +34 -0
- data/plugins/key_bindings/plugin.rb +8 -0
- data/plugins/{tree → key_bindings}/spec/spec_helper.rb +0 -0
- data/plugins/line_tools/features/lower_text.feature +3 -4
- data/plugins/line_tools/lib/line_tools.rb +6 -5
- data/plugins/mirah/lib/mirah.rb +2 -2
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +5 -3
- data/plugins/project/features/open_directory_tree.feature +1 -1
- data/plugins/project/features/step_definitions/file_steps.rb +5 -5
- data/plugins/project/features/step_definitions/find_file_steps.rb +2 -3
- data/plugins/project/features/support/env.rb +4 -0
- data/plugins/project/lib/project.rb +15 -9
- data/plugins/project/lib/project/commands.rb +46 -16
- data/plugins/project/lib/project/dir_controller.rb +1 -1
- data/plugins/project/lib/project/dir_mirror.rb +3 -2
- data/plugins/project/lib/project/drb_service.rb +3 -1
- data/plugins/project/lib/project/file_list.rb +99 -21
- data/plugins/project/lib/project/find_file_dialog.rb +8 -24
- data/plugins/project/lib/project/manager.rb +68 -12
- data/plugins/project/lib/project/project_tree_controller.rb +1 -1
- data/plugins/project/plugin.rb +1 -2
- data/plugins/project_search/features/word_search.feature +1 -1
- data/plugins/project_search/lib/project_search.rb +16 -6
- data/plugins/project_search/lib/project_search/commands.rb +15 -28
- data/plugins/project_search/lib/project_search/hit.rb +4 -0
- data/plugins/project_search/lib/project_search/lucene_index.rb +14 -4
- data/plugins/project_search/lib/project_search/views/_file.html.erb +11 -11
- data/plugins/project_search/lib/project_search/word_search.rb +22 -4
- data/plugins/project_search/spec/project_search/word_search_spec.rb +2 -2
- data/plugins/redcar/redcar.rb +140 -588
- data/plugins/repl/features/step_definitions/repl_steps.rb +3 -3
- data/plugins/repl/features/support/fake_repl.rb +1 -1
- data/plugins/ruby/lib/ruby.rb +4 -4
- data/plugins/runnables/features/fixtures/alternate.ruby +1 -0
- data/plugins/runnables/features/fixtures/line_app.rb +1 -0
- data/plugins/runnables/features/fixtures/name_app.rb +1 -0
- data/plugins/runnables/features/fixtures/params_app.rb +1 -0
- data/plugins/runnables/features/fixtures/runnable_app.rb +1 -0
- data/plugins/runnables/lib/runnables.rb +21 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +14 -9
- data/plugins/runnables/lib/runnables/output_processor.rb +4 -4
- data/plugins/runnables/lib/runnables/running_process_checker.rb +6 -6
- data/plugins/runnables/plugin.rb +1 -2
- data/plugins/scm/lib/scm.rb +18 -18
- data/plugins/scm/lib/scm/commit_mirror.rb +2 -2
- data/plugins/scm/lib/scm/scm_changes_controller.rb +1 -1
- data/plugins/scm_hg/lib/scm_hg.rb +1 -1
- data/plugins/snippets/lib/snippets/document_controller.rb +46 -40
- data/plugins/swt/lib/swt.rb +2 -0
- data/plugins/test_runner/lib/test_runner.rb +1 -0
- data/plugins/test_runner/lib/test_runner/jasmine_test_runner.rb +15 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +21 -5
- data/plugins/textmate/lib/textmate.rb +5 -1
- data/plugins/textmate/lib/textmate/preference.rb +4 -0
- data/plugins/textmate/lib/textmate/snippet.rb +0 -2
- data/plugins/textmate/lib/textmate/tree_mirror.rb +6 -5
- data/plugins/textmate/plugin.rb +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/C.tmbundle/Syntaxes/C.plist +2 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +0 -4
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +3 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Palm-WebOS-Development.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/SQL.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Scala.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Vala.tmbundle/info.plist +4 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Webrat.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/YAML.tmbundle/Syntaxes/YAML.plist +1 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/groovy.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Themes/Twilight.tmTheme +0 -2
- data/plugins/todo_list/lib/todo_list.rb +3 -3
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +11 -4
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -1
- data/plugins/web_bookmarks/plugin.rb +1 -2
- metadata +29 -20
- data/plugins/core/lib/core/logger.rb +0 -28
- data/plugins/file_parser/lib/file_parser.rb +0 -125
- data/plugins/file_parser/plugin.rb +0 -7
- data/plugins/tree/plugin.rb +0 -9
@@ -144,7 +144,21 @@ module Redcar
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
|
+
def self.quit_guard
|
149
|
+
EditView::ModifiedTabsChecker.new(
|
150
|
+
Redcar.app.all_tabs.select {|t| t.is_a?(EditTab)},
|
151
|
+
"Save all before quitting?"
|
152
|
+
).check
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.close_window_guard(win)
|
156
|
+
EditView::ModifiedTabsChecker.new(
|
157
|
+
win.notebooks.map(&:tabs).flatten.select {|t| t.is_a?(EditTab)},
|
158
|
+
"Save all before closing the window?"
|
159
|
+
).check
|
160
|
+
end
|
161
|
+
|
148
162
|
def self.all_handlers(type)
|
149
163
|
result = []
|
150
164
|
method_name = :"#{type}_handlers"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Redcar
|
2
2
|
class EditView
|
3
3
|
class ModifiedTabsChecker
|
4
|
-
def initialize(tabs, message
|
5
|
-
@tabs, @message
|
4
|
+
def initialize(tabs, message)
|
5
|
+
@tabs, @message = tabs, message
|
6
6
|
end
|
7
7
|
|
8
8
|
def check
|
@@ -17,16 +17,16 @@ module Redcar
|
|
17
17
|
when :yes
|
18
18
|
modified_edit_tabs.each do |t|
|
19
19
|
t.focus
|
20
|
-
Project::
|
20
|
+
Project::SaveFileCommand.new(t).run
|
21
21
|
end
|
22
|
-
|
22
|
+
true
|
23
23
|
when :no
|
24
|
-
|
24
|
+
true
|
25
25
|
when :cancel
|
26
|
-
|
26
|
+
false
|
27
27
|
end
|
28
28
|
else
|
29
|
-
|
29
|
+
true
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -70,13 +70,14 @@ module Redcar
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def self.load_textmate_assets
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
Redcar.log.info("loaded JavaMateView #{JavaMateView::MateText.VERSION}")
|
74
|
+
Redcar.log.benchmark("load textmate assets") do
|
75
|
+
load_textmate_assets_from_dir(Redcar.root + "/plugins/textmate/vendor/redcar-bundles")
|
76
|
+
Redcar.plugin_manager.loaded_plugins.each do |plugin|
|
77
|
+
load_textmate_assets_from_dir(File.dirname(plugin.definition_file) + "/")
|
78
|
+
end
|
79
|
+
load_textmate_assets_from_dir(Redcar.user_dir + "/")
|
77
80
|
end
|
78
|
-
load_textmate_assets_from_dir(Redcar.user_dir + "/")
|
79
|
-
puts "took #{Time.now - s}s to load textmate assets"
|
80
81
|
EditView.themes.unshift(*JavaMateView::ThemeManager.themes.to_a.map {|th| th.name })
|
81
82
|
end
|
82
83
|
|
@@ -30,7 +30,7 @@ module Redcar
|
|
30
30
|
|
31
31
|
def output_tab
|
32
32
|
tabs = win.notebooks.map {|nb| nb.tabs }.flatten
|
33
|
-
tabs.detect {|t| t.title == TITLE} || Top::
|
33
|
+
tabs.detect {|t| t.title == TITLE} || Top::OpenNewEditTabCommand.new.run
|
34
34
|
end
|
35
35
|
|
36
36
|
def execute_file(path)
|
@@ -17,7 +17,7 @@ module Redcar
|
|
17
17
|
Redcar::Menu::Builder.build do
|
18
18
|
sub_menu "Plugins" do
|
19
19
|
sub_menu "REPL" do
|
20
|
-
item "Open Groovy REPL",
|
20
|
+
item "Open Groovy REPL", OpenGroovyREPL
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -25,11 +25,11 @@ module Redcar
|
|
25
25
|
|
26
26
|
def self.keymaps
|
27
27
|
osx = Keymap.build("main", :osx) do
|
28
|
-
link "Cmd+Alt+G",
|
28
|
+
link "Cmd+Alt+G", OpenGroovyREPL
|
29
29
|
end
|
30
30
|
|
31
31
|
linwin = Keymap.build("main", [:linux, :windows]) do
|
32
|
-
link "Ctrl+Alt+G",
|
32
|
+
link "Ctrl+Alt+G", OpenGroovyREPL
|
33
33
|
end
|
34
34
|
|
35
35
|
[linwin, osx]
|
@@ -20,6 +20,11 @@ module Redcar
|
|
20
20
|
rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "..", "views", "index.html.erb")))
|
21
21
|
rhtml.result(binding)
|
22
22
|
end
|
23
|
+
|
24
|
+
def add_key_binding(key, command)
|
25
|
+
return unless key && key.length > 0
|
26
|
+
Redcar::KeyBindings.add_key_binding key, command
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
25
30
|
end
|
@@ -3,6 +3,15 @@
|
|
3
3
|
<title>Keyboard Shortcuts</title>
|
4
4
|
<% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins help views default.css))) %>
|
5
5
|
<link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">
|
6
|
+
<%= javascript_controller_actions %>
|
7
|
+
<script type="text/javascript" src="file://<%= Redcar::HtmlView.jquery_path %>"></script>
|
8
|
+
<script>
|
9
|
+
function addKeyBinding(command) {
|
10
|
+
var key = prompt("Key for " + command, "");
|
11
|
+
Controller.addKeyBinding(key, command);
|
12
|
+
window.location.href = "controller/index";
|
13
|
+
}
|
14
|
+
</script>
|
6
15
|
</head>
|
7
16
|
<body>
|
8
17
|
<h1>Keyboard Shortcuts</h1>
|
@@ -18,7 +27,7 @@
|
|
18
27
|
<% i = 0 %>
|
19
28
|
<% Redcar.app.main_keymap.map.sort_by{|key, command| clean_name(command)}.each do |key, command| %>
|
20
29
|
<tr class="<%= i % 2 == 0 ? 'even':'odd'%>">
|
21
|
-
<td><%= clean_name(command) %></td>
|
30
|
+
<td><a href="javascript:addKeyBinding('<%=command %>');"><%= clean_name(command) %></a></td>
|
22
31
|
<td><%= key %></td>
|
23
32
|
<% i = i + 1%>
|
24
33
|
</tr>
|
@@ -25,18 +25,3 @@ After do
|
|
25
25
|
reset_htmlview_fixtures
|
26
26
|
end
|
27
27
|
|
28
|
-
$:.push("plugins/html_view/vendor/nokogiri/lib")
|
29
|
-
require 'nokogiri'
|
30
|
-
|
31
|
-
p Nokogiri::HTML("<h1>afso</h1>")
|
32
|
-
|
33
|
-
$:.push("plugins/html_view/vendor/capybara/lib")
|
34
|
-
require 'capybara'
|
35
|
-
require 'capybara/dsl'
|
36
|
-
|
37
|
-
$:.push("plugins/html_view/vendor/capybara-sweet/lib")
|
38
|
-
require 'capybara/driver/sweet'
|
39
|
-
|
40
|
-
Capybara.default_driver = :sweet
|
41
|
-
|
42
|
-
World(Capybara)
|
@@ -4,7 +4,6 @@ require 'html_view/browser_bar'
|
|
4
4
|
require 'html_view/html_tab'
|
5
5
|
require 'html_controller'
|
6
6
|
require 'html_view/default_controller'
|
7
|
-
require 'json'
|
8
7
|
|
9
8
|
module Redcar
|
10
9
|
class HtmlView
|
@@ -19,7 +18,7 @@ module Redcar
|
|
19
18
|
def self.keymaps
|
20
19
|
map = Redcar::Keymap.build("main", [:osx, :linux, :windows]) do
|
21
20
|
link "Alt+Shift+B", ToggleBrowserBar
|
22
|
-
link "Alt+Shift+P",
|
21
|
+
link "Alt+Shift+P", ViewFileInWebBrowserCommand
|
23
22
|
end
|
24
23
|
[map]
|
25
24
|
end
|
@@ -27,7 +26,7 @@ module Redcar
|
|
27
26
|
def self.menus
|
28
27
|
Redcar::Menu::Builder.build do
|
29
28
|
sub_menu "File" do
|
30
|
-
item "Web Preview", :command =>
|
29
|
+
item "Web Preview", :command => ViewFileInWebBrowserCommand, :priority => 8
|
31
30
|
end
|
32
31
|
sub_menu "View" do
|
33
32
|
item "Toggle Browser Bar", :command => ToggleBrowserBar, :priority => 11
|
@@ -42,7 +41,7 @@ module Redcar
|
|
42
41
|
storage
|
43
42
|
end
|
44
43
|
end
|
45
|
-
|
44
|
+
|
46
45
|
def self.show_browser_bar?
|
47
46
|
if win = Redcar.app.focussed_window and
|
48
47
|
win.speedbar and win.speedbar.is_a?(BrowserBar)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
# $:.push(File.expand_path(File.join(File.dirname(__FILE__),
|
3
|
+
# "vendor", "activesupport-3.0.3", "lib")))
|
4
|
+
#
|
5
|
+
# require 'active_support'
|
6
|
+
# require 'active_support/inflections'
|
7
|
+
module Redcar
|
8
|
+
# This class is your plugin. Try adding new commands in here
|
9
|
+
# and putting them in the menus.
|
10
|
+
class KeyBindings
|
11
|
+
|
12
|
+
def self.user_keybindings
|
13
|
+
key_bindings = key_binding_prefs.inject({}) do |h, (key, command_class)|
|
14
|
+
h[key] = eval(command_class)
|
15
|
+
h
|
16
|
+
end
|
17
|
+
key_bindings
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.storage
|
21
|
+
@storage ||= Plugin::Storage.new('key_bindings')
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.key_binding_prefs
|
25
|
+
storage["key_bindings"] ||= {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.add_key_binding(key, command)
|
29
|
+
key_binding_prefs[key] = command
|
30
|
+
storage.save
|
31
|
+
Redcar.app.refresh_menu!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
File without changes
|
@@ -13,6 +13,7 @@ Scenario: Lowering a multi-line selection
|
|
13
13
|
And I select from 5 to 9
|
14
14
|
And I lower the text
|
15
15
|
Then I should see "foo\nbonne\nbar\nbaz" in the edit tab
|
16
|
+
And the selected text should be "bar\nbaz"
|
16
17
|
|
17
18
|
Scenario: Lowering the last line of a document
|
18
19
|
When I open a new edit tab
|
@@ -41,8 +42,9 @@ Scenario: Lowering a multi-line selection including the last line of a document
|
|
41
42
|
And I replace the contents with "foo\nbar\nbaz\nbonne"
|
42
43
|
And I select from 8 to 12
|
43
44
|
And I lower the text
|
44
|
-
Then I should see "foo\nbar\nbaz
|
45
|
+
Then I should see "foo\nbar\nbonne\nbaz" in the edit tab
|
45
46
|
And I should not see "foo\nbar\n\nbaz\nbonne" in the edit tab
|
47
|
+
And the selected text should be "baz"
|
46
48
|
|
47
49
|
Scenario: Should work with unicode
|
48
50
|
When I open a new edit tab
|
@@ -50,6 +52,3 @@ Scenario: Should work with unicode
|
|
50
52
|
And I move the cursor to 5
|
51
53
|
And I lower the text
|
52
54
|
Then the contents should be "foo\nbaz\nbść\nbonne"
|
53
|
-
|
54
|
-
|
55
|
-
|
@@ -163,7 +163,7 @@ module Redcar
|
|
163
163
|
doc.cursor_offset = insert_idx + cursor_line_offset
|
164
164
|
if keep_selection
|
165
165
|
doc.set_selection_range(doc.offset_at_line(first_line_ix-1),
|
166
|
-
doc.
|
166
|
+
doc.offset_at_inner_end_of_line(last_line_ix-1))
|
167
167
|
end
|
168
168
|
doc.scroll_to_line(top)
|
169
169
|
end
|
@@ -179,14 +179,14 @@ module Redcar
|
|
179
179
|
if doc.selection?
|
180
180
|
first_line_ix = doc.line_at_offset(doc.selection_range.begin)
|
181
181
|
last_line_ix = doc.line_at_offset(doc.selection_range.end)
|
182
|
-
|
182
|
+
|
183
183
|
if doc.selection_range.begin == doc.offset_at_inner_end_of_line(first_line_ix)
|
184
184
|
first_line_ix += 1
|
185
185
|
end
|
186
186
|
if doc.selection_range.end == doc.offset_at_line(last_line_ix)
|
187
187
|
last_line_ix -= 1
|
188
188
|
end
|
189
|
-
|
189
|
+
|
190
190
|
text = doc.get_slice(doc.offset_at_line(first_line_ix),
|
191
191
|
doc.offset_at_line_end(last_line_ix))
|
192
192
|
keep_selection = true
|
@@ -211,8 +211,9 @@ module Redcar
|
|
211
211
|
doc.replace(doc.offset_at_line(first_line_ix), swap_text.split(//).length, new_text)
|
212
212
|
doc.cursor_offset = doc.offset_at_line(last_line_ix+1) + cursor_line_offset
|
213
213
|
if keep_selection
|
214
|
-
doc.
|
215
|
-
|
214
|
+
start_selection = doc.offset_at_line(first_line_ix+1)
|
215
|
+
end_selection = doc.offset_at_inner_end_of_line(last_line_ix+1)
|
216
|
+
doc.set_selection_range(start_selection, end_selection)
|
216
217
|
end
|
217
218
|
doc.scroll_to_line(last_line_ix+1)
|
218
219
|
end
|
data/plugins/mirah/lib/mirah.rb
CHANGED
@@ -10,7 +10,7 @@ module Redcar
|
|
10
10
|
Menu::Builder.build do
|
11
11
|
sub_menu "Plugins" do
|
12
12
|
sub_menu "REPL" do
|
13
|
-
item "Open Mirah REPL",
|
13
|
+
item "Open Mirah REPL", OpenMirahREPL
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -34,7 +34,7 @@ module Redcar
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
class
|
37
|
+
class OpenMirahREPL < Redcar::REPL::OpenREPL
|
38
38
|
def execute
|
39
39
|
open_repl(ReplMirror.new)
|
40
40
|
end
|
@@ -68,9 +68,11 @@ module Redcar
|
|
68
68
|
|
69
69
|
def clear
|
70
70
|
if @highlight.on?
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
if @highlight.current < document.length
|
72
|
+
styledText.redrawRange(@highlight.current, 1, false)
|
73
|
+
styledText.redrawRange(@highlight.pair, 1, false) # if on the same line
|
74
|
+
@highlight.clear
|
75
|
+
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
@@ -14,7 +14,7 @@ Feature: Open directory tree
|
|
14
14
|
When I open a directory
|
15
15
|
Given I will choose "plugins" from the "open_directory" dialog
|
16
16
|
When I open a directory
|
17
|
-
Then I should see "core,application,
|
17
|
+
Then I should see "core,application,tree_view_swt" in the tree
|
18
18
|
|
19
19
|
Scenario: Open a directory and then the same using another Redcar invocation
|
20
20
|
Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
Given /^I have open a file$/ do
|
3
|
-
Redcar::Project::
|
3
|
+
Redcar::Project::OpenFileCommand.new.run
|
4
4
|
end
|
5
5
|
|
6
6
|
Given /^I will open a large file from the "([^"]*)" dialog$/ do |arg1|
|
@@ -9,15 +9,15 @@ Given /^I will open a large file from the "([^"]*)" dialog$/ do |arg1|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
When /^I open a file$/ do
|
12
|
-
Redcar::Project::
|
12
|
+
Redcar::Project::OpenFileCommand.new.run
|
13
13
|
end
|
14
14
|
|
15
15
|
Given /^I have opened "([^\"]*)"$/ do |arg1|
|
16
|
-
Redcar::Project::
|
16
|
+
Redcar::Project::OpenFileCommand.new(File.expand_path(arg1)).run
|
17
17
|
end
|
18
18
|
|
19
19
|
When /^I save the tab$/ do
|
20
|
-
Redcar::Project::
|
20
|
+
Redcar::Project::SaveFileCommand.new.run
|
21
21
|
end
|
22
22
|
|
23
23
|
When /^I touch the file "([^\"]*)"$/ do |fn|
|
@@ -30,7 +30,7 @@ When /^I put "([^\"]*)" into the file "([^\"]*)"$/ do |contents, path|
|
|
30
30
|
end
|
31
31
|
|
32
32
|
When /^I save the tab as$/ do
|
33
|
-
Redcar::Project::
|
33
|
+
Redcar::Project::SaveFileAsCommand.new.run
|
34
34
|
end
|
35
35
|
|
36
36
|
Then /^the file "([^\"]*)" should contain "([^\"]*)"$/ do |arg1, arg2|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
When /^I prefer not to see files like "([^"]*)" in the find file dialog$/ do |pattern|
|
2
|
-
|
3
|
-
ignored = filter_storage['ignore_files_that_match_these_regexes']
|
2
|
+
ignored = shared_ignored_storage['ignored_file_patterns']
|
4
3
|
ignored << /#{pattern}/
|
5
4
|
filter_storage['ignore_file_patterns'] = true
|
6
|
-
|
5
|
+
shared_ignored_storage['ignored_file_patterns'] = ignored
|
7
6
|
end
|
8
7
|
|
9
8
|
When /^I open the find file dialog$/ do
|
@@ -49,6 +49,10 @@ def filter_storage
|
|
49
49
|
Redcar::Project::FindFileDialog.storage
|
50
50
|
end
|
51
51
|
|
52
|
+
def shared_ignored_storage
|
53
|
+
Redcar::Project::FindFileDialog.shared_storage
|
54
|
+
end
|
55
|
+
|
52
56
|
Before do
|
53
57
|
reset_project_fixtures
|
54
58
|
@original_file_size_limit = Redcar::Project::Manager.file_size_limit
|
@@ -86,21 +86,21 @@ module Redcar
|
|
86
86
|
Manager.storage['last_open_dir'] = path
|
87
87
|
Project.window_projects[window] = self
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
def lock
|
91
91
|
File.open(lock_filename, "w") do |fout|
|
92
92
|
fout.puts "#{$$}: Locked by #{$$} at #{Time.now}"
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def lock_filename
|
97
97
|
File.join(config_dir, "redcar.lock")
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def locked?
|
101
101
|
File.exist?(lock_filename)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
def unlock
|
105
105
|
if locked?
|
106
106
|
if locked_by_this_process?
|
@@ -112,7 +112,7 @@ module Redcar
|
|
112
112
|
raise "project not locked"
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
def locked_by_this_process?
|
117
117
|
return false unless locked?
|
118
118
|
locking_pid = File.read(lock_filename).split(":").first
|
@@ -128,10 +128,10 @@ module Redcar
|
|
128
128
|
this_window.title = Window::DEFAULT_TITLE
|
129
129
|
Manager.open_project_sensitivity.recompute
|
130
130
|
Redcar.plugin_manager.objects_implementing(:project_closed).each do |i|
|
131
|
-
i.project_closed(self)
|
131
|
+
i.project_closed(self,this_window)
|
132
132
|
end
|
133
133
|
listeners = {}
|
134
|
-
unlock
|
134
|
+
unlock if locked?
|
135
135
|
end
|
136
136
|
|
137
137
|
def attach_listeners
|
@@ -151,12 +151,14 @@ module Redcar
|
|
151
151
|
end
|
152
152
|
|
153
153
|
def notebook_focussed(notebook)
|
154
|
-
|
154
|
+
if notebook.focussed_tab and tree and Project::Manager.reveal_file?(self)
|
155
|
+
RevealInProjectCommand.new.run
|
156
|
+
end
|
155
157
|
end
|
156
158
|
|
157
159
|
def notebook_added(notebook)
|
158
160
|
@listeners.merge!(notebook => notebook.add_listener(:tab_focussed) do |tab|
|
159
|
-
RevealInProjectCommand.new.run if tree
|
161
|
+
RevealInProjectCommand.new.run if tree and window and Project::Manager.reveal_file?(self)
|
160
162
|
end)
|
161
163
|
end
|
162
164
|
|
@@ -253,5 +255,9 @@ module Redcar
|
|
253
255
|
file_glob = File.join("{#{config_dir},#{Redcar.user_dir}}", glob)
|
254
256
|
Dir[file_glob]
|
255
257
|
end
|
258
|
+
|
259
|
+
def search(query)
|
260
|
+
ProjectSearch::WordSearch.new(self, query, false, 0)
|
261
|
+
end
|
256
262
|
end
|
257
263
|
end
|