redcar 0.3.4.1 → 0.3.4.2
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 -0
- data/Rakefile +1 -1
- data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +1 -1
- data/plugins/core/spec/core/storage_spec.rb +1 -1
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +2 -2
- data/plugins/edit_view/lib/edit_view/document.rb +16 -5
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +4 -0
- data/plugins/project/lib/project/file_mirror.rb +1 -1
- data/plugins/redcar/redcar.rb +2 -2
- data/plugins/repl/lib/repl/internal_mirror.rb +7 -7
- data/plugins/textmate/lib/textmate/environment.rb +3 -1
- metadata +2 -2
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ module Redcar
|
|
7
7
|
|
8
8
|
def after_newline(line_ix)
|
9
9
|
if line_ix > 0
|
10
|
-
previous_line = document.get_line(line_ix - 1).gsub(
|
10
|
+
previous_line = document.get_line(line_ix - 1).gsub(document.delim, "")
|
11
11
|
whitespace_prefix = whitespace_prefix(previous_line)
|
12
12
|
offset = document.offset_at_line(line_ix)
|
13
13
|
document.insert(offset, whitespace_prefix)
|
@@ -44,8 +44,8 @@ module Redcar
|
|
44
44
|
|
45
45
|
def self.move_left_offset(edit_view)
|
46
46
|
doc = edit_view.document
|
47
|
-
return 0
|
48
|
-
return doc.cursor_offset -
|
47
|
+
return 0 if doc.cursor_offset == 0
|
48
|
+
return doc.cursor_offset - doc.delim.length if doc.cursor_line_offset == 0
|
49
49
|
if edit_view.soft_tabs?
|
50
50
|
line = doc.get_line(doc.cursor_line)
|
51
51
|
width = edit_view.tab_width
|
@@ -96,7 +96,7 @@ module Redcar
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
@controllers[Controller::NewlineCallback].each do |controller|
|
99
|
-
if text ==
|
99
|
+
if text == line_delimiter
|
100
100
|
rescue_document_controller_error(controller) do
|
101
101
|
controller.after_newline(line_at_offset(start_offset) + 1)
|
102
102
|
end
|
@@ -129,6 +129,17 @@ module Redcar
|
|
129
129
|
controller.single_line?
|
130
130
|
end
|
131
131
|
|
132
|
+
# Returns the line delimiter for this document. Either
|
133
|
+
# \n or \r\n. It will attempt to detect the delimiter from the document
|
134
|
+
# or it will default to the platform delimiter.
|
135
|
+
#
|
136
|
+
# @return [String]
|
137
|
+
def line_delimiter
|
138
|
+
controller.get_line_delimiter
|
139
|
+
end
|
140
|
+
|
141
|
+
alias :delim :line_delimiter
|
142
|
+
|
132
143
|
# Is there any text selected? (Or equivalently, is the length
|
133
144
|
# of the selection equal to 0)
|
134
145
|
#
|
@@ -142,7 +153,7 @@ module Redcar
|
|
142
153
|
# @param [Integer] offset character offset from the start of the document
|
143
154
|
# @param [String] text text to insert
|
144
155
|
def insert(offset, text)
|
145
|
-
text = text.gsub(
|
156
|
+
text = text.gsub(delim, "") if single_line?
|
146
157
|
replace(offset, 0, text)
|
147
158
|
end
|
148
159
|
|
@@ -167,7 +178,7 @@ module Redcar
|
|
167
178
|
# @param [Integer] length length of text to replace
|
168
179
|
# @param [String] text replacement text
|
169
180
|
def replace(offset, length, text)
|
170
|
-
text = text.gsub(
|
181
|
+
text = text.gsub(delim, "") if single_line?
|
171
182
|
controller.replace(offset, length, text)
|
172
183
|
end
|
173
184
|
|
@@ -359,14 +370,14 @@ module Redcar
|
|
359
370
|
replace(start_offset, end_offset - start_offset, text)
|
360
371
|
end
|
361
372
|
|
362
|
-
# Get the offset at the end of a given line, *before* the
|
373
|
+
# Get the offset at the end of a given line, *before* the line delimiter.
|
363
374
|
#
|
364
375
|
# @param [Integer] line_ix a zero-based line index
|
365
376
|
def offset_at_inner_end_of_line(line_ix)
|
366
377
|
if line_ix == line_count - 1
|
367
378
|
length
|
368
379
|
else
|
369
|
-
offset_at_line(line_ix + 1) -
|
380
|
+
offset_at_line(line_ix + 1) - delim.length
|
370
381
|
end
|
371
382
|
end
|
372
383
|
|
data/plugins/redcar/redcar.rb
CHANGED
@@ -544,7 +544,7 @@ module Redcar
|
|
544
544
|
|
545
545
|
link "Cmd+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
546
546
|
|
547
|
-
link "Cmd+
|
547
|
+
link "Cmd+Alt+S", Snippets::OpenSnippetExplorer
|
548
548
|
#Textmate.attach_keybindings(self, :osx)
|
549
549
|
end
|
550
550
|
|
@@ -586,7 +586,7 @@ module Redcar
|
|
586
586
|
link "Ctrl+Page Down", SwitchTabUpCommand
|
587
587
|
link "Ctrl+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
588
588
|
|
589
|
-
link "Ctrl+
|
589
|
+
link "Ctrl+Alt+S", Snippets::OpenSnippetExplorer
|
590
590
|
#Textmate.attach_keybindings(self, :linux)
|
591
591
|
|
592
592
|
end
|
@@ -106,13 +106,13 @@ module Redcar
|
|
106
106
|
orig_stdout = $stdout
|
107
107
|
stdout_handler = StringIO.new
|
108
108
|
$stdout = stdout_handler
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
begin
|
110
|
+
result = eval(command, @binding)
|
111
|
+
ensure
|
112
|
+
$stdout.rewind
|
113
|
+
@output = $stdout.read
|
114
|
+
$stdout = orig_stdout
|
115
|
+
end
|
116
116
|
result
|
117
117
|
end
|
118
118
|
end
|
@@ -9,7 +9,9 @@ module Redcar
|
|
9
9
|
current_scope = nil
|
10
10
|
if document = Redcar::EditView.focussed_edit_view_document
|
11
11
|
line = document.get_line(document.cursor_line)
|
12
|
-
|
12
|
+
if line =~ /#{document.delim}$/
|
13
|
+
line = line[0..(-1*document.delim.length - 1)]
|
14
|
+
end
|
13
15
|
@env['TM_CURRENT_LINE'] = line
|
14
16
|
@env['TM_LINE_INDEX'] = document.cursor_line_offset.to_s
|
15
17
|
@env['TM_LINE_NUMBER'] = (document.cursor_line + 1).to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.4.
|
4
|
+
version: 0.3.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lucraft
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-08 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|