redcar 0.9.2 → 0.10
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.
- data/CHANGES +34 -4
- data/Rakefile +2 -1
- data/lib/redcar.rb +3 -3
- data/lib/redcar/installer.rb +2 -3
- data/plugins/application/features/step_definitions/dialog_steps.rb +7 -0
- data/plugins/application/features/step_definitions/key_steps.rb +18 -0
- data/plugins/application/features/step_definitions/menu_steps.rb +5 -6
- data/plugins/application/features/step_definitions/speedbar_steps.rb +29 -9
- data/plugins/application/features/step_definitions/tree_steps.rb +13 -0
- data/plugins/application/features/support/env.rb +39 -5
- data/plugins/application/features/support/fake_event.rb +12 -0
- data/plugins/application/lib/application.rb +5 -6
- data/plugins/application/lib/application/dialog.rb +53 -10
- data/plugins/application/lib/application/dialogs/modeless_list_dialog.rb +85 -0
- data/plugins/application/lib/application/keymap.rb +10 -8
- data/plugins/application/lib/application/menu.rb +38 -16
- data/plugins/application/lib/application/treebook.rb +30 -0
- data/plugins/application/lib/application/window.rb +20 -2
- data/plugins/application/spec/application/command/executor_spec.rb +1 -0
- data/plugins/application/spec/application/menu_spec.rb +26 -26
- data/plugins/application/spec/application/treebook_spec.rb +6 -6
- data/plugins/application/spec/spec_helper.rb +10 -1
- data/plugins/application_swt/lib/application_swt.rb +25 -3
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +48 -27
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +22 -11
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_dialog.rb +113 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_html_dialog.rb +85 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_list_dialog_controller.rb +143 -0
- data/plugins/application_swt/lib/application_swt/gradient.rb +61 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -8
- data/plugins/application_swt/lib/application_swt/speedbar.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +6 -8
- data/plugins/application_swt/lib/application_swt/window.rb +85 -57
- data/plugins/application_swt/lib/swt/graphics_utils.rb +23 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +7 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +142 -0
- data/plugins/auto_completer/lib/auto_completer.rb +10 -42
- data/plugins/auto_completer/lib/auto_completer/list_dialog.rb +21 -0
- data/plugins/clojure/lib/clojure.rb +33 -0
- data/plugins/{repl/lib/repl/clojure_mirror.rb → clojure/lib/clojure/repl_mirror.rb} +16 -20
- data/plugins/clojure/plugin.rb +9 -0
- data/plugins/{repl/spec/repl/clojure_mirror_spec.rb → clojure/spec/clojure/repl_mirror_spec.rb} +12 -13
- data/plugins/clojure/spec/spec_helper.rb +5 -0
- data/plugins/{repl → clojure}/vendor/Wrapper.clj +0 -0
- data/plugins/{repl → clojure}/vendor/dummy +0 -0
- data/plugins/{repl → clojure}/vendor/enclojure-wrapper.jar +0 -0
- data/plugins/connection_manager/lib/connection_manager.rb +13 -13
- data/plugins/declarations/lib/declarations.rb +17 -6
- data/plugins/document_search/features/find.feature +389 -0
- data/plugins/document_search/features/find_and_replace.feature +723 -0
- data/plugins/document_search/features/replace.feature +69 -62
- data/plugins/document_search/lib/document_search.rb +81 -64
- data/plugins/document_search/lib/document_search/commands.rb +258 -0
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +142 -0
- data/plugins/document_search/lib/document_search/find_speedbar.rb +102 -0
- data/plugins/document_search/lib/document_search/query_options.rb +45 -0
- data/plugins/edit_view/features/case_change.feature +9 -5
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +19 -0
- data/plugins/edit_view/lib/edit_view.rb +15 -12
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +12 -2
- data/plugins/edit_view/lib/edit_view/commands/text_conversion_commands.rb +1 -1
- data/plugins/edit_view/lib/edit_view/document.rb +129 -99
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +33 -15
- data/plugins/encryption/encryption.rb +2 -0
- data/plugins/find-in-project/lib/find_in_project.rb +3 -5
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +2 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +2 -2
- data/plugins/groovy/features/syntax_check_groovy.feature +3 -3
- data/plugins/groovy/lib/groovy.rb +38 -0
- data/plugins/groovy/lib/groovy/commands.rb +10 -0
- data/plugins/{repl/lib/repl/groovy_mirror.rb → groovy/lib/groovy/repl_mirror.rb} +33 -13
- data/plugins/groovy/lib/{syntax_check/groovy.rb → groovy/syntax_checker.rb} +13 -8
- data/plugins/groovy/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb} +14 -13
- data/plugins/groovy/spec/spec_helper.rb +5 -0
- data/plugins/html_view/assets/json2.js +476 -0
- data/plugins/html_view/lib/html_view.rb +1 -0
- data/plugins/java/features/fixtures/test.java +0 -0
- data/plugins/java/features/support/env.rb +27 -0
- data/plugins/java/features/syntax_check_java.feature +86 -0
- data/plugins/java/lib/syntax_check/java.rb +86 -0
- data/plugins/java/plugin.rb +7 -0
- data/plugins/javascript/features/fixtures/test2.js +5 -0
- data/plugins/javascript/features/step_definitions/javascript_steps.rb +16 -0
- data/plugins/javascript/features/support/env.rb +14 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +46 -3
- data/plugins/javascript/lib/syntax_check/javascript.rb +15 -9
- data/plugins/line_tools/features/trim_line.feature +49 -0
- data/plugins/line_tools/lib/line_tools.rb +5 -1
- data/plugins/mirah/README +7 -0
- data/plugins/mirah/features/fixtures/test.mirah +2 -0
- data/plugins/mirah/features/syntax_check_mirah.feature +46 -0
- data/plugins/mirah/lib/mirah.rb +43 -0
- data/plugins/mirah/lib/mirah/my_error_handler.rb +22 -0
- data/plugins/mirah/lib/mirah/repl_mirror.rb +50 -0
- data/plugins/mirah/lib/mirah/syntax_checker.rb +38 -0
- data/plugins/mirah/plugin.rb +8 -0
- data/plugins/mirah/spec/mirah/repl_mirror_spec.rb +188 -0
- data/plugins/mirah/spec/spec_helper.rb +5 -0
- data/plugins/mirah/vendor/mirah-parser.jar +0 -0
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +24 -23
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +10 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +2 -0
- data/plugins/project/features/find_file.feature +40 -16
- data/plugins/project/features/highlight_focussed_tab.feature +16 -10
- data/plugins/project/features/step_definitions/find_file_steps.rb +11 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +5 -1
- data/plugins/project/features/support/env.rb +5 -0
- data/plugins/project/lib/project/commands.rb +8 -1
- data/plugins/project/lib/project/dir_controller.rb +4 -1
- data/plugins/project/lib/project/find_file_dialog.rb +16 -12
- data/plugins/project/lib/project/manager.rb +30 -1
- data/plugins/project_search/vendor/lucene/CHANGELOG +147 -0
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +17 -0
- data/plugins/project_search/vendor/lucene/Gemfile +9 -0
- data/plugins/project_search/vendor/lucene/Gemfile.lock +33 -0
- data/plugins/project_search/vendor/lucene/LICENSE +19 -0
- data/plugins/project_search/vendor/lucene/README.rdoc +283 -0
- data/plugins/project_search/vendor/lucene/Rakefile +35 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +25 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +4 -0
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +29 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +4376 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +153 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +18 -0
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +21 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +9 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +7 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +5 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +121 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +30 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +50 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +19 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +66 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +23 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/README +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +56 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +37 -0
- data/plugins/project_search/vendor/lucene/examples/railway/README +111 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +31 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +42 -0
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +41 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +60 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +50 -0
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +15 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +145 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +96 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +144 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +54 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +267 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +146 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +157 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +5 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +135 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +117 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +3 -0
- data/plugins/project_search/vendor/lucene/lucene.gemspec +23 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +32 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +70 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +76 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +643 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +142 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +101 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +10 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +118 -0
- data/plugins/redcar/features/alter_font_size.feature +25 -0
- data/plugins/redcar/features/step_definitions/font_steps.rb +34 -0
- data/plugins/redcar/redcar.rb +256 -43
- data/plugins/repl/features/command_editing.feature +55 -0
- data/plugins/repl/features/command_history.feature +75 -0
- data/plugins/repl/features/step_definitions/repl_steps.rb +17 -1
- data/plugins/repl/features/support/env.rb +24 -0
- data/plugins/repl/features/support/fake_repl.rb +16 -0
- data/plugins/repl/lib/repl.rb +17 -74
- data/plugins/repl/lib/repl/repl_command.rb +20 -0
- data/plugins/repl/lib/repl/repl_mirror.rb +168 -22
- data/plugins/repl/lib/repl/repl_tab.rb +131 -6
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +72 -0
- data/plugins/repl/spec/spec_helper.rb +1 -1
- data/plugins/repl_swt/lib/repl_swt.rb +7 -0
- data/plugins/repl_swt/lib/repl_swt/key_listener.rb +43 -0
- data/plugins/repl_swt/plugin.rb +8 -0
- data/plugins/ruby/lib/ruby.rb +35 -0
- data/plugins/{repl/lib/repl/ruby_mirror.rb → ruby/lib/ruby/repl_mirror.rb} +12 -12
- data/plugins/ruby/lib/{syntax_check/ruby.rb → ruby/syntax_checker.rb} +3 -3
- data/plugins/ruby/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/ruby_mirror_spec.rb → ruby/spec/ruby/repl_mirror_spec.rb} +38 -29
- data/plugins/ruby/spec/spec_helper.rb +5 -0
- data/plugins/runnables/lib/runnables.rb +2 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +5 -0
- data/plugins/runnables/lib/runnables/output_processor.rb +14 -3
- data/plugins/runnables/views/command_output.html.erb +3 -2
- data/plugins/scm/lib/scm.rb +4 -2
- data/plugins/scm/lib/scm/diff_mirror.rb +6 -6
- data/plugins/scm_git/lib/scm_git.rb +136 -107
- data/plugins/scm_git/lib/scm_git/change.rb +28 -19
- data/plugins/snippets/lib/snippets/explorer.rb +2 -2
- data/plugins/swt/lib/swt/full_swt.rb +1 -0
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +4 -0
- data/plugins/syntax_check/features/support/env.rb +3 -0
- data/plugins/syntax_check/lib/syntax_check.rb +71 -5
- data/plugins/syntax_check/lib/syntax_check/annotation.rb +61 -0
- data/plugins/test_runner/lib/test_runner.rb +39 -0
- data/plugins/test_runner/lib/test_runner/rspec_runner.rb +20 -0
- data/plugins/test_runner/lib/test_runner/run_test_command.rb +63 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +26 -0
- data/plugins/test_runner/plugin.rb +8 -0
- data/plugins/test_runner/spec/run_test_command_spec.rb +51 -0
- data/plugins/test_runner/spec/spec_helper.rb +5 -0
- data/plugins/textmate/lib/textmate.rb +12 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/HTML.tmbundle/Syntaxes/HTML.plist +0 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/Syntaxes/Mirah.plist +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +12 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist +2 -0
- data/plugins/todo_list/lib/todo_list.rb +7 -0
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +3 -1
- data/plugins/tree/lib/tree.rb +4 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +5 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +10 -0
- metadata +137 -22
- data/plugins/document_search/features/search.feature +0 -163
- data/plugins/document_search/lib/document_search/replace_all_command.rb +0 -27
- data/plugins/document_search/lib/document_search/replace_command.rb +0 -38
- data/plugins/document_search/lib/document_search/replace_next_command.rb +0 -27
- data/plugins/document_search/lib/document_search/search_and_replace.rb +0 -81
- data/plugins/ruby/README +0 -6
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
@speedbar
|
|
3
|
-
Feature: Search in file
|
|
4
|
-
|
|
5
|
-
Background:
|
|
6
|
-
Given I open a new edit tab
|
|
7
|
-
|
|
8
|
-
Scenario: Open search speedbar
|
|
9
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
10
|
-
And I move the cursor to 0
|
|
11
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
12
|
-
Then the DocumentSearch::SearchSpeedbar speedbar should be open
|
|
13
|
-
|
|
14
|
-
Scenario: Search for a word should select next occurrence
|
|
15
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
16
|
-
And I move the cursor to 0
|
|
17
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
18
|
-
And I type "Bar" into the "Search" field in the speedbar
|
|
19
|
-
And I press "Search" in the speedbar
|
|
20
|
-
Then the selected text should be "Bar"
|
|
21
|
-
|
|
22
|
-
Scenario: Search twice should move to the next occurrence
|
|
23
|
-
When I replace the contents with "Foo\nBar\nFoo"
|
|
24
|
-
And I move the cursor to 0
|
|
25
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
26
|
-
And I type "Foo" into the "Search" field in the speedbar
|
|
27
|
-
And I press "Search" in the speedbar
|
|
28
|
-
And I press "Search" in the speedbar
|
|
29
|
-
Then the selected text should be "Foo"
|
|
30
|
-
And the selection should be on line 2
|
|
31
|
-
|
|
32
|
-
Scenario: Search for a word adjacent to cursor should select word
|
|
33
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
34
|
-
And I move the cursor to 0
|
|
35
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
36
|
-
And I type "Foo" into the "Search" field in the speedbar
|
|
37
|
-
And I press "Search" in the speedbar
|
|
38
|
-
Then the selected text should be "Foo"
|
|
39
|
-
|
|
40
|
-
Scenario: Search for a word should find occurrence after the cursor
|
|
41
|
-
When I replace the contents with "Foo\nBar\nBaz\nFoo"
|
|
42
|
-
And I move the cursor to 1
|
|
43
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
44
|
-
And I type "Foo" into the "Search" field in the speedbar
|
|
45
|
-
And I press "Search" in the speedbar
|
|
46
|
-
Then the selected text should be "Foo"
|
|
47
|
-
And the selection should be on line 3
|
|
48
|
-
|
|
49
|
-
Scenario: Search for a word should wrap to earlier occurrence if none left
|
|
50
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
51
|
-
And I move the cursor to 1
|
|
52
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
53
|
-
And I type "Foo" into the "Search" field in the speedbar
|
|
54
|
-
And I press "Search" in the speedbar
|
|
55
|
-
Then the selected text should be "Foo"
|
|
56
|
-
And the selection should be on line 0
|
|
57
|
-
|
|
58
|
-
Scenario: Doesn't search for a regex by default
|
|
59
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
60
|
-
And I move the cursor to 0
|
|
61
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
62
|
-
And I type "Ba." into the "Search" field in the speedbar
|
|
63
|
-
And I press "Search" in the speedbar
|
|
64
|
-
Then there should not be any text selected
|
|
65
|
-
|
|
66
|
-
Scenario: Search for a regex
|
|
67
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
68
|
-
And I move the cursor to 0
|
|
69
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
70
|
-
And I type "Ba." into the "Search" field in the speedbar
|
|
71
|
-
And I check "Regex" in the speedbar
|
|
72
|
-
And I press "Search" in the speedbar
|
|
73
|
-
Then the selected text should be "Bar"
|
|
74
|
-
|
|
75
|
-
Scenario: Search for a regex matches a second time
|
|
76
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
77
|
-
And I move the cursor to 0
|
|
78
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
79
|
-
And I type "Ba." into the "Search" field in the speedbar
|
|
80
|
-
And I check "Regex" in the speedbar
|
|
81
|
-
And I press "Search" in the speedbar
|
|
82
|
-
And I press "Search" in the speedbar
|
|
83
|
-
Then the selected text should be "Baz"
|
|
84
|
-
|
|
85
|
-
Scenario: Should not match case by default
|
|
86
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
87
|
-
And I move the cursor to 0
|
|
88
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
89
|
-
And I type "foo" into the "Search" field in the speedbar
|
|
90
|
-
And I press "Search" in the speedbar
|
|
91
|
-
Then the selected text should be "Foo"
|
|
92
|
-
|
|
93
|
-
Scenario: Should match case if requested
|
|
94
|
-
When I replace the contents with "Foo\nBar\nBaz"
|
|
95
|
-
And I move the cursor to 0
|
|
96
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
97
|
-
And I type "foo" into the "Search" field in the speedbar
|
|
98
|
-
And I check "Match case" in the speedbar
|
|
99
|
-
And I press "Search" in the speedbar
|
|
100
|
-
Then there should not be any text selected
|
|
101
|
-
|
|
102
|
-
Scenario: Should scroll to the match
|
|
103
|
-
When I replace the contents with 100 lines of "xxx" then "Foo"
|
|
104
|
-
And I scroll to the top of the document
|
|
105
|
-
And I move the cursor to 0
|
|
106
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
107
|
-
And I type "Foo" into the "Search" field in the speedbar
|
|
108
|
-
And I press "Search" in the speedbar
|
|
109
|
-
Then the selected text should be "Foo"
|
|
110
|
-
And line number 100 should be visible
|
|
111
|
-
|
|
112
|
-
Scenario: Should reopen with the same text as the previous search
|
|
113
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
114
|
-
And I type "foo" into the "Search" field in the speedbar
|
|
115
|
-
And I press "Search" in the speedbar
|
|
116
|
-
And I close the speedbar
|
|
117
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
118
|
-
Then the "Search" field in the speedbar should have text "foo"
|
|
119
|
-
|
|
120
|
-
Scenario: Should reopen with the same value of Regex as the previous search
|
|
121
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
122
|
-
And I check "Regex" in the speedbar
|
|
123
|
-
And I press "Search" in the speedbar
|
|
124
|
-
And I close the speedbar
|
|
125
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
126
|
-
Then "Regex" should be checked in the speedbar
|
|
127
|
-
|
|
128
|
-
Scenario: Should reopen with the same value of Regex as the previous search 2
|
|
129
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
130
|
-
And I check "Regex" in the speedbar
|
|
131
|
-
And I press "Search" in the speedbar
|
|
132
|
-
And I close the speedbar
|
|
133
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
134
|
-
And I uncheck "Regex" in the speedbar
|
|
135
|
-
And I press "Search" in the speedbar
|
|
136
|
-
And I close the speedbar
|
|
137
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
138
|
-
Then "Regex" should not be checked in the speedbar
|
|
139
|
-
|
|
140
|
-
Scenario: Should reopen with the same value of Match case as the previous search
|
|
141
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
142
|
-
And I check "Match case" in the speedbar
|
|
143
|
-
And I press "Search" in the speedbar
|
|
144
|
-
And I close the speedbar
|
|
145
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
146
|
-
Then "Match case" should be checked in the speedbar
|
|
147
|
-
|
|
148
|
-
Scenario: Should initialize query with the currently selected text
|
|
149
|
-
When I replace the contents with "Foo\nBar\nFoo"
|
|
150
|
-
And I move the cursor to 0
|
|
151
|
-
And I select from 0 to 3
|
|
152
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
153
|
-
Then the "Search" field in the speedbar should have text "Foo"
|
|
154
|
-
|
|
155
|
-
Scenario: Should match the next occurence of the currently selected text
|
|
156
|
-
When I replace the contents with "Foo\nBar\nFoo"
|
|
157
|
-
And I move the cursor to 0
|
|
158
|
-
And I select from 0 to 3
|
|
159
|
-
And I run the command DocumentSearch::SearchForwardCommand
|
|
160
|
-
And I press "Search" in the speedbar
|
|
161
|
-
Then the selected text should be "Foo"
|
|
162
|
-
And line number 2 should be visible
|
|
163
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
module DocumentSearch
|
|
2
|
-
class ReplaceAllCommand < ReplaceCommand
|
|
3
|
-
def execute
|
|
4
|
-
startoff, endoff = nil
|
|
5
|
-
text = doc.get_all_text
|
|
6
|
-
count = 0
|
|
7
|
-
sc = StringScanner.new(text)
|
|
8
|
-
while sc.scan_until(query)
|
|
9
|
-
count += 1
|
|
10
|
-
|
|
11
|
-
startoff = sc.pos - sc.matched_size
|
|
12
|
-
replacement_text = text.slice(startoff, sc.matched_size).gsub(query, replace)
|
|
13
|
-
endoff = startoff + replacement_text.length
|
|
14
|
-
|
|
15
|
-
text[startoff...sc.pos] = replacement_text
|
|
16
|
-
sc.string = text
|
|
17
|
-
sc.pos = startoff + replacement_text.length
|
|
18
|
-
end
|
|
19
|
-
if count > 0
|
|
20
|
-
doc.text = text
|
|
21
|
-
doc.set_selection_range(startoff + replacement_text.length, startoff)
|
|
22
|
-
doc.scroll_to_line(doc.line_at_offset(startoff))
|
|
23
|
-
end
|
|
24
|
-
count
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module DocumentSearch
|
|
2
|
-
class ReplaceCommand < Redcar::DocumentCommand
|
|
3
|
-
attr_reader :query, :replace
|
|
4
|
-
|
|
5
|
-
def initialize(query, replace, search_method)
|
|
6
|
-
@replace = replace
|
|
7
|
-
@query = send(search_method, query)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# An instance of a search type method: Regular expression
|
|
11
|
-
def regex_search_query(query)
|
|
12
|
-
/#{query}/
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# An instance of a search type method: Plain text search
|
|
16
|
-
def plain_search_query(query)
|
|
17
|
-
regex_search_query(Regexp.escape(query))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# An instance of a search type method: Glob text search
|
|
21
|
-
# Converts a glob pattern (* or ?) into a regex pattern
|
|
22
|
-
def glob_search_query(query)
|
|
23
|
-
# convert the glob pattern to a regex pattern
|
|
24
|
-
new_query = ""
|
|
25
|
-
query.each_char do |c|
|
|
26
|
-
case c
|
|
27
|
-
when "*"
|
|
28
|
-
new_query << ".*"
|
|
29
|
-
when "?"
|
|
30
|
-
new_query << "."
|
|
31
|
-
else
|
|
32
|
-
new_query << Regexp.escape(c)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
regex_search_query(new_query)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
module DocumentSearch
|
|
2
|
-
class ReplaceNextCommand < ReplaceCommand
|
|
3
|
-
# The current selection is usually not used for the next replacement, unless
|
|
4
|
-
# it matches the query string, in which case we assume that the user meant replace it, too
|
|
5
|
-
def start_position
|
|
6
|
-
offsets = [doc.cursor_offset, doc.selection_offset]
|
|
7
|
-
return offsets.min if query == doc.selected_text
|
|
8
|
-
offsets.max
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def execute
|
|
12
|
-
sc = StringScanner.new(doc.get_all_text)
|
|
13
|
-
sc.pos = start_position
|
|
14
|
-
sc.scan_until(query) || sc.reset && sc.scan_until(query)
|
|
15
|
-
|
|
16
|
-
return 0 unless sc.matched?
|
|
17
|
-
startoff = sc.pos - sc.matched_size
|
|
18
|
-
|
|
19
|
-
text = doc.get_range(startoff, sc.matched_size)
|
|
20
|
-
replacement_text = text.gsub(query, replace)
|
|
21
|
-
doc.replace(sc.pos - sc.matched_size, sc.matched_size, replacement_text)
|
|
22
|
-
doc.set_selection_range(startoff + replacement_text.length, startoff)
|
|
23
|
-
doc.scroll_to_line(doc.line_at_offset(startoff))
|
|
24
|
-
1
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module DocumentSearch
|
|
3
|
-
class SearchAndReplaceSpeedbar < Redcar::Speedbar
|
|
4
|
-
class << self
|
|
5
|
-
attr_accessor :previous_query
|
|
6
|
-
attr_accessor :previous_replace
|
|
7
|
-
attr_accessor :previous_search_type
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
attr_accessor :initial_query
|
|
11
|
-
|
|
12
|
-
def after_draw
|
|
13
|
-
SearchSpeedbar.previous_query ||= ""
|
|
14
|
-
self.query.value = @initial_query || SearchSpeedbar.previous_query
|
|
15
|
-
self.replace.value = SearchAndReplaceSpeedbar.previous_replace || ""
|
|
16
|
-
self.search_type.value = SearchAndReplaceSpeedbar.previous_search_type
|
|
17
|
-
self.query.edit_view.document.select_all
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
label :label_search, "Search:"
|
|
21
|
-
textbox :query
|
|
22
|
-
|
|
23
|
-
label :label_replace, "Replace:"
|
|
24
|
-
textbox :replace
|
|
25
|
-
|
|
26
|
-
combo :search_type, ["Regex", "Plain", "Glob"], "RegEx" do |v|
|
|
27
|
-
SearchAndReplaceSpeedbar.previous_search_type = v
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
button :single_replace, "Replace", "Return" do
|
|
31
|
-
SearchAndReplaceSpeedbar.previous_query = query.value
|
|
32
|
-
SearchAndReplaceSpeedbar.previous_replace = replace.value
|
|
33
|
-
SearchAndReplaceSpeedbar.previous_search_type = search_type.value || "Regex" # Hack to work around fact that default value not being picked up
|
|
34
|
-
success = SearchAndReplaceSpeedbar.search_replace
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
button :all_replace, "Replace All", nil do
|
|
38
|
-
SearchAndReplaceSpeedbar.previous_query = query.value
|
|
39
|
-
SearchAndReplaceSpeedbar.previous_replace = replace.value
|
|
40
|
-
SearchAndReplaceSpeedbar.previous_search_type = search_type.value || "Regex" # Hack to work around fact that default value not being picked up
|
|
41
|
-
success = SearchAndReplaceSpeedbar.search_replace_all
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def self.search_method
|
|
45
|
-
case @previous_search_type
|
|
46
|
-
when "Regex"
|
|
47
|
-
search_method = :regex_search_query
|
|
48
|
-
when "Plain"
|
|
49
|
-
search_method = :plain_search_query
|
|
50
|
-
when "Glob"
|
|
51
|
-
search_method = :glob_search_query
|
|
52
|
-
else
|
|
53
|
-
search_method = :regex_search_query
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def self.search_replace
|
|
58
|
-
current_query = @previous_query
|
|
59
|
-
current_replace = @previous_replace
|
|
60
|
-
adoc = Redcar.app.focussed_notebook_tab.document
|
|
61
|
-
cmd = ReplaceNextCommand.new(current_query, current_replace, search_method)
|
|
62
|
-
count = cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
|
|
63
|
-
if count == 0
|
|
64
|
-
Redcar::Application::Dialog.message_box("No instance of the search string were found", {:type => :info, :buttons => :ok})
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def self.search_replace_all
|
|
69
|
-
current_query = @previous_query
|
|
70
|
-
current_replace = @previous_replace
|
|
71
|
-
cmd = ReplaceAllCommand.new(current_query, current_replace, search_method)
|
|
72
|
-
count = cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
|
|
73
|
-
if count == 0 or count > 1
|
|
74
|
-
message = "Replaced #{count} occurrences"
|
|
75
|
-
else
|
|
76
|
-
message = "Replaced #{count} occurrence"
|
|
77
|
-
end
|
|
78
|
-
Redcar::Application::Dialog.message_box(message, {:type => :info, :buttons => :ok})
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|