redcar-dev 0.12.17dev → 0.12.18dev
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 +4 -2
- data/README.md +5 -41
- data/Rakefile +3 -35
- data/lib/redcar.rb +19 -17
- data/lib/redcar/runner.rb +1 -7
- data/lib/redcar_quick_start.rb +5 -5
- data/plugins/application/features/main_menu.feature +1 -1
- data/plugins/application/features/step_definitions/command_steps.rb +8 -7
- data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +25 -10
- data/plugins/application/features/step_definitions/key_steps.rb +6 -4
- data/plugins/application/features/step_definitions/menu_steps.rb +27 -26
- data/plugins/application/features/step_definitions/speedbar_steps.rb +28 -16
- data/plugins/application/features/step_definitions/tree_steps.rb +88 -64
- data/plugins/application/features/step_definitions/window_steps.rb +14 -10
- data/plugins/application/features/support/env.rb +85 -83
- data/plugins/application/spec/application/application_spec.rb +1 -1
- data/plugins/application/spec/application/clipboard_spec.rb +1 -1
- data/plugins/application/spec/application/command/executor_spec.rb +1 -1
- data/plugins/application/spec/application/command/history_spec.rb +1 -1
- data/plugins/application/spec/application/command_spec.rb +1 -1
- data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/menu_item_spec.rb +1 -1
- data/plugins/application/spec/application/menu_spec.rb +1 -1
- data/plugins/application/spec/application/navigation_history_spec.rb +2 -0
- data/plugins/application/spec/application/notebook_spec.rb +1 -1
- data/plugins/application/spec/application/sensitive_spec.rb +1 -1
- data/plugins/application/spec/application/speedbar_spec.rb +1 -1
- data/plugins/application/spec/application/treebook_spec.rb +1 -1
- data/plugins/application/spec/application/window_spec.rb +1 -1
- data/plugins/application/spec/spec_helper.rb +4 -6
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +1 -1
- data/plugins/application_swt/lib/application_swt/gradient.rb +15 -5
- data/plugins/application_swt/lib/application_swt/window.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +13 -14
- data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +1 -1
- data/plugins/application_swt/spec/application_swt/menu_spec.rb +1 -1
- data/plugins/application_swt/spec/spec_helper.rb +1 -19
- data/plugins/auto_completer/features/auto_complete.feature +7 -7
- data/plugins/auto_completer/features/step_definitions/auto_complete_steps.rb +3 -1
- data/plugins/auto_completer/features/step_definitions/dependency_steps.rb +0 -0
- data/plugins/auto_indenter/features/java_style_indentation.feature +5 -3
- data/plugins/auto_indenter/features/ruby_style_indentation.feature +13 -13
- data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +3 -1
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +1 -1
- data/plugins/auto_indenter/spec/spec_helper.rb +1 -5
- data/plugins/auto_pairer/features/auto_pairer.feature +1 -1
- data/plugins/comment/features/line_comment.feature +31 -26
- data/plugins/comment/features/selection_comment.feature +1 -1
- data/plugins/comment/features/step_definitions/comment_steps.rb +6 -2
- data/plugins/comment/vendor/comment_lib.json +2 -0
- data/plugins/core/lib/core.rb +26 -0
- data/plugins/core/spec/core/base_storage_spec.rb +1 -1
- data/plugins/core/spec/core/gui_spec.rb +1 -1
- data/plugins/core/spec/core/observable_spec.rb +2 -1
- data/plugins/core/spec/core/persistent_cache_spec.rb +1 -1
- data/plugins/core/spec/core/shared_storage_spec.rb +1 -1
- data/plugins/core/spec/core/storage_spec.rb +1 -1
- data/plugins/core/spec/core/task_queue_spec.rb +1 -3
- data/plugins/core/spec/spec_helper.rb +1 -4
- data/plugins/declarations/spec/declarations/file_spec.rb +1 -1
- data/plugins/declarations/spec/spec_helper.rb +1 -5
- data/plugins/document_search/features/find.feature +39 -39
- data/plugins/document_search/features/step_definitions/find_steps.rb +6 -2
- data/plugins/edit_view/features/align_assignment.feature +6 -82
- data/plugins/edit_view/features/case_change.feature +22 -22
- data/plugins/edit_view/features/cursor_navigation.feature +2 -2
- data/plugins/edit_view/features/cut_and_paste.feature +9 -9
- data/plugins/edit_view/features/indentation_commands.feature +8 -8
- data/plugins/edit_view/features/line_delimiter.feature +7 -7
- data/plugins/edit_view/features/multiple_windows.feature +48 -48
- data/plugins/edit_view/features/step_definitions/dependency_steps.rb +0 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +237 -127
- data/plugins/edit_view/features/step_definitions/grammar_steps.rb +5 -1
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +38 -24
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +83 -45
- data/plugins/edit_view/features/step_definitions/window_steps.rb +75 -54
- data/plugins/edit_view/features/support/env.rb +4 -23
- data/plugins/edit_view/lib/edit_view/commands/align_assignment_command.rb +29 -30
- data/plugins/edit_view/lib/edit_view/document.rb +23 -0
- data/plugins/edit_view/spec/edit_view/commands/align_assignment_command_spec.rb +83 -0
- data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +1 -1
- data/plugins/edit_view/spec/edit_view/document_spec.rb +1 -1
- data/plugins/edit_view/spec/spec_helper.rb +1 -4
- data/plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb +1 -1
- data/plugins/edit_view_swt/spec/spec_helper.rb +1 -4
- data/plugins/html_view/features/fixtures/sample.html +1 -1
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +40 -39
- data/plugins/java/features/syntax_check_java.feature +18 -16
- data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +18 -6
- data/plugins/macros/features/block_selection_in_macros.feature +47 -47
- data/plugins/macros/features/step_definitions/macro_steps.rb +9 -3
- data/plugins/macros/features/step_definitions/prediction_steps.rb +6 -2
- data/plugins/macros/plugin.rb +2 -1
- data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +1 -1
- data/plugins/macros/spec/spec_helper.rb +1 -6
- data/plugins/outline_view/features/outline_view.feature +5 -5
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +29 -17
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -1
- data/plugins/project/features/close_directory_tree.feature +0 -12
- data/plugins/project/features/open_directory_tree.feature +1 -2
- data/plugins/project/features/step_definitions/directory_steps.rb +13 -5
- data/plugins/project/features/step_definitions/file_steps.rb +23 -9
- data/plugins/project/features/step_definitions/find_file_steps.rb +6 -2
- data/plugins/project/features/step_definitions/project_tree_steps.rb +6 -2
- data/plugins/project/features/watch_for_modified_files.feature +1 -1
- data/plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb +1 -1
- data/plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb +1 -1
- data/plugins/project/spec/project/adapters/remote_spec.rb +1 -1
- data/plugins/project/spec/project/dir_mirror_spec.rb +1 -1
- data/plugins/project/spec/project/file_list_spec.rb +1 -1
- data/plugins/project/spec/project/file_mirror_spec.rb +2 -1
- data/plugins/project/spec/spec_helper.rb +1 -4
- data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +1 -1
- data/plugins/project_search/spec/project_search/word_search_spec.rb +1 -1
- data/plugins/project_search/spec/spec_helper.rb +1 -4
- data/plugins/{application → redcar}/features/navigation_history.feature +8 -8
- data/plugins/redcar/features/step_definitions/font_steps.rb +9 -5
- data/plugins/redcar/redcar.rb +0 -26
- data/plugins/repl/features/step_definitions/repl_steps.rb +15 -5
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +1 -1
- data/plugins/repl/spec/spec_helper.rb +1 -4
- data/plugins/ruby/spec/ruby/repl_mirror_spec.rb +1 -1
- data/plugins/ruby/spec/spec_helper.rb +1 -5
- data/plugins/runnables/features/parameter_input.feature +43 -43
- data/plugins/runnables/features/step_definitions/runnable_steps.rb +9 -3
- data/plugins/runnables/plugin.rb +2 -2
- data/plugins/runnables/spec/runnables/output_processor_spec.rb +1 -1
- data/plugins/runnables/spec/spec_helper.rb +1 -5
- data/plugins/scm_svn/features/add_and_commit.feature +1 -0
- data/plugins/scm_svn/features/checkout.feature +1 -0
- data/plugins/scm_svn/features/edit_and_index.feature +1 -0
- data/plugins/scm_svn/features/ignore_files.feature +1 -0
- data/plugins/scm_svn/features/merge.feature +1 -0
- data/plugins/scm_svn/features/resolve_conflict.feature +1 -0
- data/plugins/scm_svn/features/revert_and_delete.feature +1 -0
- data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +14 -9
- data/plugins/scm_svn/features/support/env.rb +4 -4
- data/plugins/scm_svn/features/switch_branches.feature +1 -0
- data/plugins/scm_svn/features/update.feature +1 -0
- data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +4 -4
- data/plugins/test_runner/plugin.rb +3 -1
- data/plugins/test_runner/spec/run_test_command_spec.rb +58 -50
- data/plugins/test_runner/spec/spec_helper.rb +1 -5
- data/plugins/textmate/features/step_definitions/tree_steps.rb +2 -0
- data/plugins/todo_list/features/todo_list.feature +1 -1
- data/plugins/todo_list/spec/spec_helper.rb +1 -4
- data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +1 -1
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +2 -1
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
- metadata +48 -48
- data/lib/redcar/installer.rb +0 -178
- data/plugins/key_bindings/spec/spec_helper.rb +0 -5
- data/plugins/scm/spec/spec_helper.rb +0 -5
|
File without changes
|
|
@@ -8,237 +8,339 @@ def escape_text(text)
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
When /^I undo$/ do
|
|
11
|
-
|
|
11
|
+
Swt.sync_exec do
|
|
12
|
+
Redcar::Top::UndoCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
13
|
+
end
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
When /^I redo$/ do
|
|
15
|
-
|
|
17
|
+
Swt.sync_exec do
|
|
18
|
+
Redcar::Top::RedoCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
When /^I select (-?)(\d+) from \((\d+), ?(\d+)\)$/ do |minus, length, start_line, start_line_offset|
|
|
23
|
+
length = length.to_i
|
|
24
|
+
length = length * -1 if minus == "-"
|
|
25
|
+
Swt.bot.styled_text.select_range(start_line.to_i, start_line_offset.to_i, length)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
When /^I select from \((\d+), ?(\d+)\) to \((\d+), ?(\d+)\)$/ do |start_line, start_line_offset, end_line, end_line_offset|
|
|
29
|
+
length = nil
|
|
30
|
+
Swt.sync_exec do
|
|
31
|
+
doc = implicit_edit_view.document
|
|
32
|
+
start_of_end_line = doc.offset_at_line(end_line.to_i)
|
|
33
|
+
end_offset = start_of_end_line + end_line_offset.to_i
|
|
34
|
+
|
|
35
|
+
start_of_start_line = doc.offset_at_line(start_line.to_i)
|
|
36
|
+
start_offset = start_of_start_line + start_line_offset.to_i
|
|
37
|
+
length = end_offset - start_offset
|
|
38
|
+
end
|
|
39
|
+
Swt.bot.styled_text.select_range(start_line.to_i, start_line_offset.to_i, length)
|
|
16
40
|
end
|
|
17
41
|
|
|
18
42
|
When /^I select from (\d+) to (\d+)$/ do |start_offset, end_offset|
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
Swt.sync_exec do
|
|
44
|
+
doc = implicit_edit_view.document
|
|
45
|
+
doc.set_selection_range(start_offset.to_i, end_offset.to_i)
|
|
46
|
+
end
|
|
21
47
|
end
|
|
22
48
|
|
|
23
49
|
When /^I copy text$/ do
|
|
24
|
-
Redcar::Top::CopyCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
50
|
+
# Redcar::Top::CopyCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
51
|
+
When "I select menu item \"Edit|Copy\""
|
|
25
52
|
end
|
|
26
53
|
|
|
27
54
|
When /^I cut text$/ do
|
|
28
|
-
Redcar::Top::CutCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
55
|
+
# Redcar::Top::CutCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
56
|
+
When "I select menu item \"Edit|Cut\""
|
|
29
57
|
end
|
|
30
58
|
|
|
31
59
|
When /^I paste text$/ do
|
|
32
|
-
Redcar::Top::PasteCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
60
|
+
# Redcar::Top::PasteCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
61
|
+
When "I select menu item \"Edit|Paste\""
|
|
33
62
|
end
|
|
34
63
|
|
|
35
64
|
When /^I move the cursor to (\d+)$/ do |offset|
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
Swt.sync_exec do
|
|
66
|
+
implicit_edit_view.document.cursor_offset = offset.to_i
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
When /^I move the cursor to \((\d+),(\d+)\)$/ do |line, line_offset|
|
|
71
|
+
Swt.bot.styled_text.navigate_to(line.to_i, line_offset.to_i)
|
|
38
72
|
end
|
|
39
73
|
|
|
40
74
|
When /^I move the cursor to the end of the document$/ do
|
|
41
|
-
|
|
42
|
-
|
|
75
|
+
Swt.sync_exec do
|
|
76
|
+
doc = implicit_edit_view.document
|
|
77
|
+
doc.cursor_offset = doc.length
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Then /^the cursor should be at \((\d+),(\d+)\)$/ do |line, line_offset|
|
|
82
|
+
position = Swt.bot.styled_text.cursor_position
|
|
83
|
+
position.line.should == line.to_i
|
|
84
|
+
position.column.should == line_offset.to_i
|
|
43
85
|
end
|
|
44
86
|
|
|
45
87
|
Then /^the cursor should be at (\d+)$/ do |offset|
|
|
46
|
-
|
|
47
|
-
|
|
88
|
+
Swt.sync_exec do
|
|
89
|
+
doc = implicit_edit_view.document
|
|
90
|
+
doc.cursor_offset.should == offset.to_i
|
|
91
|
+
end
|
|
48
92
|
end
|
|
49
93
|
|
|
50
94
|
When /^tabs are hard$/ do
|
|
51
|
-
|
|
95
|
+
Swt.sync_exec do
|
|
96
|
+
implicit_edit_view.soft_tabs = false
|
|
97
|
+
end
|
|
52
98
|
end
|
|
53
99
|
|
|
54
100
|
When /^tabs are soft, (\d+) spaces$/ do |int|
|
|
55
|
-
|
|
56
|
-
|
|
101
|
+
Swt.sync_exec do
|
|
102
|
+
implicit_edit_view.soft_tabs = true
|
|
103
|
+
implicit_edit_view.tab_width = int.to_i
|
|
104
|
+
end
|
|
57
105
|
end
|
|
58
106
|
|
|
59
107
|
When /^I insert "(.*)" at the cursor$/ do |text|
|
|
60
|
-
|
|
108
|
+
Swt.sync_exec do
|
|
109
|
+
implicit_edit_view.document.insert_at_cursor(unescape_text(text))
|
|
110
|
+
end
|
|
61
111
|
end
|
|
62
112
|
|
|
63
113
|
When /^I insert "(.*)" at (\d+)$/ do |text, offset_s|
|
|
64
|
-
|
|
114
|
+
Swt.sync_exec do
|
|
115
|
+
implicit_edit_view.document.insert(offset_s.to_i, unescape_text(text))
|
|
116
|
+
end
|
|
65
117
|
end
|
|
66
118
|
|
|
67
119
|
When /^I replace (\d+) to (\d+) with "(.*)"$/ do |from, to, text|
|
|
68
|
-
|
|
120
|
+
Swt.sync_exec do
|
|
121
|
+
implicit_edit_view.document.replace(from.to_i, to.to_i - from.to_i, unescape_text(text))
|
|
122
|
+
end
|
|
69
123
|
end
|
|
70
124
|
|
|
71
125
|
When /^I press the Tab key in the edit tab$/ do
|
|
72
|
-
|
|
126
|
+
Swt.sync_exec do
|
|
127
|
+
implicit_edit_view.tab_pressed([])
|
|
128
|
+
end
|
|
73
129
|
end
|
|
74
130
|
|
|
75
131
|
When /^I press Shift\+Tab in the edit tab$/ do
|
|
76
|
-
|
|
132
|
+
Swt.sync_exec do
|
|
133
|
+
implicit_edit_view.tab_pressed(["Shift"])
|
|
134
|
+
end
|
|
77
135
|
end
|
|
78
136
|
|
|
79
137
|
When /^I press the Left key in the edit tab$/ do
|
|
80
|
-
|
|
138
|
+
Swt.sync_exec do
|
|
139
|
+
implicit_edit_view.left_pressed([])
|
|
140
|
+
end
|
|
81
141
|
end
|
|
82
142
|
|
|
83
143
|
When /^I press the Right key in the edit tab$/ do
|
|
84
|
-
|
|
144
|
+
Swt.sync_exec do
|
|
145
|
+
implicit_edit_view.right_pressed([])
|
|
146
|
+
end
|
|
85
147
|
end
|
|
86
148
|
|
|
87
149
|
When /^I press Shift\+Left key in the edit tab$/ do
|
|
88
|
-
|
|
150
|
+
Swt.sync_exec do
|
|
151
|
+
implicit_edit_view.left_pressed(["Shift"])
|
|
152
|
+
end
|
|
89
153
|
end
|
|
90
154
|
|
|
91
155
|
When /^I press Shift\+Right key in the edit tab$/ do
|
|
92
|
-
|
|
156
|
+
Swt.sync_exec do
|
|
157
|
+
implicit_edit_view.right_pressed(["Shift"])
|
|
158
|
+
end
|
|
93
159
|
end
|
|
94
160
|
|
|
95
161
|
When /^I press the Delete key in the edit tab$/ do
|
|
96
|
-
|
|
162
|
+
Swt.sync_exec do
|
|
163
|
+
implicit_edit_view.delete_pressed([])
|
|
164
|
+
end
|
|
97
165
|
end
|
|
98
166
|
|
|
99
167
|
When /^I press the Backspace key in the edit tab$/ do
|
|
100
|
-
|
|
101
|
-
edit_view.backspace_pressed([])
|
|
168
|
+
Swt.bot.styled_text.type_text("\b")
|
|
102
169
|
end
|
|
103
170
|
|
|
104
171
|
Then /^the contents should (not )?be "(.*)"$/ do |negative,text|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
char_seloff
|
|
172
|
+
Swt.sync_exec do
|
|
173
|
+
expected = unescape_text(text)
|
|
174
|
+
doc = implicit_edit_view.document
|
|
175
|
+
actual = doc.to_s
|
|
176
|
+
if expected.include?("<c>")
|
|
177
|
+
char_curoff = doc.cursor_offset
|
|
178
|
+
actual = actual.insert(actual.char_offset_to_byte_offset(char_curoff), "<c>")
|
|
179
|
+
char_seloff = doc.selection_offset
|
|
180
|
+
if char_seloff > char_curoff
|
|
181
|
+
char_seloff += 3
|
|
182
|
+
end
|
|
183
|
+
actual = actual.insert(actual.char_offset_to_byte_offset(char_seloff), "<s>") unless char_curoff == char_seloff
|
|
184
|
+
end
|
|
185
|
+
if negative
|
|
186
|
+
actual.should_not == expected
|
|
187
|
+
else
|
|
188
|
+
actual.should == expected
|
|
114
189
|
end
|
|
115
|
-
actual = actual.insert(actual.char_offset_to_byte_offset(char_seloff), "<s>") unless char_curoff == char_seloff
|
|
116
|
-
end
|
|
117
|
-
if negative
|
|
118
|
-
actual.should_not == expected
|
|
119
|
-
else
|
|
120
|
-
actual.should == expected
|
|
121
190
|
end
|
|
122
191
|
end
|
|
123
192
|
|
|
124
193
|
Then /^the contents of the edit tab should be "(.*)"$/ do |text|
|
|
125
|
-
|
|
194
|
+
Swt.sync_exec do
|
|
195
|
+
implicit_edit_view.document.to_s.should == unescape_text(text)
|
|
196
|
+
end
|
|
126
197
|
end
|
|
127
198
|
|
|
128
199
|
When /^I block select from (\d+) to (\d+)$/ do |from_str, to_str|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
200
|
+
Swt.sync_exec do
|
|
201
|
+
doc = implicit_edit_view.document
|
|
202
|
+
doc.block_selection_mode = true
|
|
203
|
+
doc.set_selection_range(from_str.to_i, to_str.to_i)
|
|
204
|
+
end
|
|
132
205
|
end
|
|
133
206
|
|
|
134
207
|
Then /^the selection range should be from (\d+) to (\d+)$/ do |from_str, to_str|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
208
|
+
Swt.sync_exec do
|
|
209
|
+
doc = implicit_edit_view.document
|
|
210
|
+
r = doc.selection_range
|
|
211
|
+
r.begin.should == from_str.to_i
|
|
212
|
+
r.end.should == to_str.to_i
|
|
213
|
+
end
|
|
139
214
|
end
|
|
140
215
|
|
|
141
216
|
Then /^the selection should be on line (.*)$/ do |line_num|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
217
|
+
Swt.sync_exec do
|
|
218
|
+
line_num = line_num.to_i
|
|
219
|
+
doc = implicit_edit_view.document
|
|
220
|
+
r = doc.selection_range
|
|
221
|
+
doc.line_at_offset(r.begin).should == line_num
|
|
222
|
+
doc.line_at_offset(r.end).should == line_num
|
|
223
|
+
end
|
|
147
224
|
end
|
|
148
225
|
|
|
149
226
|
Then /^there should not be any text selected$/ do
|
|
150
|
-
|
|
151
|
-
|
|
227
|
+
Swt.sync_exec do
|
|
228
|
+
doc = implicit_edit_view.document
|
|
229
|
+
doc.selected_text.should == ""
|
|
230
|
+
end
|
|
152
231
|
end
|
|
153
232
|
|
|
154
233
|
Then /^the selected text should be "([^"]*)"$/ do |selected_text|
|
|
155
|
-
|
|
156
|
-
doc.selected_text.should == unescape_text(selected_text)
|
|
234
|
+
Swt.bot.styled_text.selection.should == unescape_text(selected_text)
|
|
157
235
|
end
|
|
158
236
|
|
|
159
237
|
Then /the line delimiter should be "(.*)"/ do |delim|
|
|
160
|
-
|
|
161
|
-
|
|
238
|
+
Swt.sync_exec do
|
|
239
|
+
doc = implicit_edit_view.document
|
|
240
|
+
doc.delim.should == unescape_text(delim)
|
|
241
|
+
end
|
|
162
242
|
end
|
|
163
243
|
|
|
164
244
|
When /^I move to line (\d+)$/ do |num|
|
|
165
|
-
|
|
166
|
-
|
|
245
|
+
Swt.sync_exec do
|
|
246
|
+
doc = implicit_edit_view.document
|
|
247
|
+
doc.cursor_offset = doc.offset_at_line(num.to_i)
|
|
248
|
+
end
|
|
167
249
|
end
|
|
168
250
|
|
|
169
251
|
Then /^the cursor should be on line (\d+)$/ do |num|
|
|
170
|
-
|
|
171
|
-
|
|
252
|
+
Swt.sync_exec do
|
|
253
|
+
doc = implicit_edit_view.document
|
|
254
|
+
doc.cursor_line.should == num.to_i
|
|
255
|
+
end
|
|
172
256
|
end
|
|
173
257
|
|
|
174
258
|
When /^I replace the contents with "((?:[^\"]|\\")*)"$/ do |contents|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
259
|
+
Swt.sync_exec do
|
|
260
|
+
contents = unescape_text(contents)
|
|
261
|
+
doc = implicit_edit_view.document
|
|
262
|
+
cursor_offset = (contents =~ /<c>/)
|
|
263
|
+
doc.text = contents.gsub("<c>", "")
|
|
264
|
+
doc.cursor_offset = cursor_offset if cursor_offset
|
|
265
|
+
end
|
|
180
266
|
end
|
|
181
267
|
|
|
182
268
|
When /^I replace the contents with 100 lines of "([^"]*)" then "([^"]*)"$/ do |contents1, contents2|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
269
|
+
Swt.sync_exec do
|
|
270
|
+
contents1 = unescape_text(contents1)
|
|
271
|
+
contents2 = unescape_text(contents2)
|
|
272
|
+
doc = implicit_edit_view.document
|
|
273
|
+
doc.text = (contents1 + "\n")*100 + contents2
|
|
274
|
+
end
|
|
187
275
|
end
|
|
188
276
|
|
|
189
277
|
When /^I replace the contents with (\d+) "([^"]*)" then "([^"]*)"$/ do |count, contents1, contents2|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
278
|
+
Swt.sync_exec do
|
|
279
|
+
contents1 = unescape_text(contents1)
|
|
280
|
+
contents2 = unescape_text(contents2)
|
|
281
|
+
doc = implicit_edit_view.document
|
|
282
|
+
doc.text = (contents1)*count.to_i + contents2
|
|
283
|
+
end
|
|
194
284
|
end
|
|
195
285
|
|
|
196
286
|
When /^I scroll to the top of the document$/ do
|
|
197
|
-
|
|
198
|
-
|
|
287
|
+
Swt.sync_exec do
|
|
288
|
+
doc = implicit_edit_view.document
|
|
289
|
+
doc.scroll_to_line(0)
|
|
290
|
+
end
|
|
199
291
|
end
|
|
200
292
|
|
|
201
293
|
Then /^line number (\d+) should be visible$/ do |line_num|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
294
|
+
Swt.sync_exec do
|
|
295
|
+
line_num = line_num.to_i
|
|
296
|
+
doc = implicit_edit_view.document
|
|
297
|
+
(doc.biggest_visible_line >= line_num).should be_true
|
|
298
|
+
(doc.smallest_visible_line <= line_num).should be_true
|
|
299
|
+
end
|
|
206
300
|
end
|
|
207
301
|
|
|
208
302
|
Then /^horizontal offset (\d+) should be visible$/ do |offset|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
303
|
+
Swt.sync_exec do
|
|
304
|
+
offset = offset.to_i
|
|
305
|
+
doc = implicit_edit_view.document
|
|
306
|
+
(doc.largest_visible_horizontal_index >= offset).should be_true
|
|
307
|
+
(doc.smallest_visible_horizontal_index <= offset).should be_true
|
|
308
|
+
end
|
|
213
309
|
end
|
|
214
310
|
|
|
215
311
|
When /^I select the word (right of|left of|around|at) (\d+)$/ do |direction, offset|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
312
|
+
Swt.sync_exec do
|
|
313
|
+
offset = offset.to_i
|
|
314
|
+
doc = implicit_edit_view.document
|
|
315
|
+
case direction
|
|
316
|
+
when "right of"
|
|
317
|
+
range = doc.match_word_right_of(offset)
|
|
318
|
+
when "left of"
|
|
319
|
+
range = doc.match_word_left_of(offset)
|
|
320
|
+
when "around"
|
|
321
|
+
range = doc.match_word_around(offset)
|
|
322
|
+
when "at"
|
|
323
|
+
range = doc.word_range_at_offset(offset)
|
|
324
|
+
else
|
|
325
|
+
warn "unrecognized direction"
|
|
326
|
+
range = offset..offset
|
|
327
|
+
end
|
|
328
|
+
doc.set_selection_range(range.first, range.last)
|
|
230
329
|
end
|
|
231
|
-
doc.set_selection_range(range.first, range.last)
|
|
232
330
|
end
|
|
233
331
|
|
|
234
332
|
When /^I turn block selection on$/ do
|
|
235
|
-
|
|
236
|
-
|
|
333
|
+
Swt.sync_exec do
|
|
334
|
+
implicit_edit_view.document.block_selection_mode?.should == false
|
|
335
|
+
Redcar::Top::ToggleBlockSelectionCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
336
|
+
end
|
|
237
337
|
end
|
|
238
338
|
|
|
239
339
|
When /^I turn block selection off$/ do
|
|
240
|
-
|
|
241
|
-
|
|
340
|
+
Swt.sync_exec do
|
|
341
|
+
implicit_edit_view.document.block_selection_mode?.should == true
|
|
342
|
+
Redcar::Top::ToggleBlockSelectionCommand.new.run(:env => {:edit_view => implicit_edit_view})
|
|
343
|
+
end
|
|
242
344
|
end
|
|
243
345
|
|
|
244
346
|
def escape_text(text)
|
|
@@ -246,20 +348,22 @@ def escape_text(text)
|
|
|
246
348
|
end
|
|
247
349
|
|
|
248
350
|
Given /^the contents? is:$/ do |string|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if cursor_index
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
351
|
+
Swt.sync_exec do
|
|
352
|
+
cursor_index = string.index('<c>')
|
|
353
|
+
selection_index = string.index('<s>')
|
|
354
|
+
string = string.gsub('<s>', '').gsub('<c>', '')
|
|
355
|
+
When %{I replace the contents with "#{string}"}
|
|
356
|
+
|
|
357
|
+
if cursor_index and selection_index
|
|
358
|
+
if cursor_index < selection_index
|
|
359
|
+
selection_index -= 3
|
|
360
|
+
else
|
|
361
|
+
cursor_index -= 3
|
|
362
|
+
end
|
|
363
|
+
When %{I select #{cursor_index - selection_index} from #{selection_index}}
|
|
364
|
+
elsif cursor_index
|
|
365
|
+
When "I move the cursor to #{cursor_index}"
|
|
259
366
|
end
|
|
260
|
-
When %{I select from #{selection_index} to #{cursor_index}}
|
|
261
|
-
elsif cursor_index
|
|
262
|
-
When "I move the cursor to #{cursor_index}"
|
|
263
367
|
end
|
|
264
368
|
end
|
|
265
369
|
|
|
@@ -296,10 +400,7 @@ end
|
|
|
296
400
|
|
|
297
401
|
When /^I type "((?:[^"]|\\")*)"$/ do |text|
|
|
298
402
|
text = text.gsub("\\t", "\t").gsub("\\n", "\n").gsub("\\\"", "\"")
|
|
299
|
-
|
|
300
|
-
text.split(//).each do |letter|
|
|
301
|
-
edit_view.type_character(letter[0])
|
|
302
|
-
end
|
|
403
|
+
Swt.bot.styled_text.type_text(text)
|
|
303
404
|
end
|
|
304
405
|
|
|
305
406
|
edit_view_action_steps = {
|
|
@@ -317,7 +418,7 @@ edit_view_action_steps = {
|
|
|
317
418
|
:TEXT_END => "I move to the end of the text",
|
|
318
419
|
:WINDOW_START => "I move to the start of the window",
|
|
319
420
|
:WINDOW_END => "I move to the end of the window",
|
|
320
|
-
:SELECT_ALL => "I select all",
|
|
421
|
+
# :SELECT_ALL => "I select all",
|
|
321
422
|
:SELECT_LINE_UP => "I select up",
|
|
322
423
|
:SELECT_LINE_DOWN => "I select down",
|
|
323
424
|
:SELECT_LINE_START => "I select to the start of the line",
|
|
@@ -341,9 +442,18 @@ edit_view_action_steps = {
|
|
|
341
442
|
:DELETE_WORD_NEXT => "I delete to the next word"
|
|
342
443
|
}
|
|
343
444
|
|
|
445
|
+
When "I select all" do
|
|
446
|
+
char_count = Redcar.update_gui do
|
|
447
|
+
Swt.bot.styled_text.widget.get_char_count
|
|
448
|
+
end
|
|
449
|
+
Swt.bot.styled_text.select_range(0, 0, char_count)
|
|
450
|
+
end
|
|
451
|
+
|
|
344
452
|
edit_view_action_steps.each do |action_symbol, step_text|
|
|
345
453
|
When step_text do
|
|
346
|
-
|
|
454
|
+
Swt.sync_exec do
|
|
455
|
+
implicit_edit_view.invoke_action(action_symbol)
|
|
456
|
+
end
|
|
347
457
|
end
|
|
348
458
|
end
|
|
349
459
|
|