ruco 0.2.0.beta8 → 0.2.0.beta9
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/Gemfile +1 -1
- data/Gemfile.lock +2 -4
- data/VERSION +1 -1
- data/bin/ruco +2 -2
- data/lib/ruco/editor/colors.rb +15 -17
- data/lib/ruco/file_store.rb +1 -1
- data/lib/ruco/screen.rb +1 -2
- data/lib/ruco/syntax_parser.rb +4 -4
- data/lib/ruco.rb +0 -2
- data/ruco.gemspec +5 -5
- data/spec/ruco/application_spec.rb +1 -1
- data/spec/ruco/editor_spec.rb +14 -2
- data/spec/ruco/file_store_spec.rb +1 -0
- data/spec/ruco/status_bar_spec.rb +1 -1
- data/spec/ruco_spec.rb +2 -2
- data/spec/spec_helper.rb +5 -1
- metadata +8 -8
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -20,10 +20,8 @@ GEM
|
|
|
20
20
|
rspec-expectations (2.6.0)
|
|
21
21
|
diff-lcs (~> 1.1.2)
|
|
22
22
|
rspec-mocks (2.6.0)
|
|
23
|
-
textpow1x (0.
|
|
23
|
+
textpow1x (1.0.0)
|
|
24
24
|
plist (>= 3.0.1)
|
|
25
|
-
ultraviolet1x (0.12.1)
|
|
26
|
-
textpow1x (>= 0.11.0)
|
|
27
25
|
|
|
28
26
|
PLATFORMS
|
|
29
27
|
ruby
|
|
@@ -36,4 +34,4 @@ DEPENDENCIES
|
|
|
36
34
|
oniguruma
|
|
37
35
|
rake
|
|
38
36
|
rspec (~> 2)
|
|
39
|
-
|
|
37
|
+
textpow1x (>= 1)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.0.
|
|
1
|
+
0.2.0.beta9
|
data/bin/ruco
CHANGED
|
@@ -48,8 +48,8 @@ end
|
|
|
48
48
|
|
|
49
49
|
# do not use colors if the terminal does not support colors
|
|
50
50
|
# so far the only terminal that supports it:
|
|
51
|
-
# - xterm-256color on osx
|
|
52
|
-
# - xterm on ubuntu
|
|
51
|
+
# - xterm-256color on osx
|
|
52
|
+
# - xterm and xterm-256color on ubuntu 10.04+
|
|
53
53
|
# (setting ENV['TERM'] will sometimes crash un-rescue-able -> test if it works)
|
|
54
54
|
def activate_256_colors
|
|
55
55
|
require 'ruco/file_store'
|
data/lib/ruco/editor/colors.rb
CHANGED
|
@@ -7,8 +7,8 @@ module Ruco
|
|
|
7
7
|
STYLING_TIMEOUT = 4
|
|
8
8
|
|
|
9
9
|
def style_map
|
|
10
|
+
return super if @colors_took_too_long or not @options[:language]
|
|
10
11
|
map = super
|
|
11
|
-
return map if @colors_took_too_long
|
|
12
12
|
|
|
13
13
|
# disable colors if syntax-parsing takes too long
|
|
14
14
|
begin
|
|
@@ -22,39 +22,37 @@ module Ruco
|
|
|
22
22
|
return map
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
$ruco_foreground = theme.foreground
|
|
26
|
+
$ruco_background = theme.background
|
|
27
|
+
|
|
28
|
+
if syntax
|
|
29
|
+
add_syntax_highlighting_to_style_map(map, syntax)
|
|
26
30
|
|
|
27
|
-
if @selection
|
|
28
31
|
# add selection a second time so it stays on top
|
|
29
|
-
@window.add_selection_styles(map, @selection)
|
|
32
|
+
@window.add_selection_styles(map, @selection) if @selection
|
|
30
33
|
end
|
|
34
|
+
|
|
31
35
|
map
|
|
32
36
|
end
|
|
33
37
|
|
|
34
38
|
private
|
|
35
39
|
|
|
36
40
|
def syntax_info
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
else
|
|
44
|
-
[]
|
|
41
|
+
language = @options[:language]
|
|
42
|
+
possible_languages = [language.name.downcase, language.lexer]
|
|
43
|
+
|
|
44
|
+
@syntax_info ||= {}
|
|
45
|
+
lines.map do |line|
|
|
46
|
+
@syntax_info[line] ||= SyntaxParser.syntax_for_lines([line], possible_languages).first
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def add_syntax_highlighting_to_style_map(map, syntax_info)
|
|
49
|
-
return unless syntax_info
|
|
50
|
-
|
|
51
|
-
$ruco_foreground = theme.foreground
|
|
52
|
-
$ruco_background = theme.background
|
|
53
|
-
|
|
54
51
|
syntax_info.each_with_index do |syntax_positions, line|
|
|
55
52
|
next unless syntax_positions
|
|
56
53
|
syntax_positions.each do |syntax_element, columns|
|
|
57
54
|
columns = columns.move(-@window.left)
|
|
55
|
+
columns = 0...columns.last if columns.first < 0 and columns.last > 0
|
|
58
56
|
style = style_for_syntax_element(syntax_element)
|
|
59
57
|
if style and columns.first >= 0
|
|
60
58
|
map.add(style, line, columns)
|
data/lib/ruco/file_store.rb
CHANGED
data/lib/ruco/screen.rb
CHANGED
data/lib/ruco/syntax_parser.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Ruco
|
|
2
2
|
module SyntaxParser
|
|
3
|
-
#
|
|
4
|
-
|
|
3
|
+
# textpow only offers certain syntax
|
|
4
|
+
TEXTPOW_CONVERT = {
|
|
5
5
|
'scss' => 'sass',
|
|
6
6
|
'html+erb' => 'html_rails',
|
|
7
7
|
}
|
|
@@ -19,10 +19,10 @@ module Ruco
|
|
|
19
19
|
@@syntax_node ||= {}
|
|
20
20
|
@@syntax_node[languages] ||= begin
|
|
21
21
|
found = nil
|
|
22
|
-
fallbacks = languages.map{|l|
|
|
22
|
+
fallbacks = languages.map{|l| TEXTPOW_CONVERT[l] }.compact
|
|
23
23
|
|
|
24
24
|
(languages + fallbacks).detect do |language|
|
|
25
|
-
syntax = File.join(
|
|
25
|
+
syntax = File.join(Textpow.syntax_path, "#{language}.syntax")
|
|
26
26
|
found = Textpow::SyntaxNode.load(syntax) if File.exist?(syntax)
|
|
27
27
|
end
|
|
28
28
|
|
data/lib/ruco.rb
CHANGED
data/ruco.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{ruco}
|
|
8
|
-
s.version = "0.2.0.
|
|
8
|
+
s.version = "0.2.0.beta9"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Michael Grosser"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-10-02}
|
|
13
13
|
s.default_executable = %q{ruco}
|
|
14
14
|
s.email = %q{michael@grosser.it}
|
|
15
15
|
s.executables = ["ruco"]
|
|
@@ -92,16 +92,16 @@ Gem::Specification.new do |s|
|
|
|
92
92
|
|
|
93
93
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
94
94
|
s.add_runtime_dependency(%q<clipboard>, [">= 0.9.8"])
|
|
95
|
-
s.add_runtime_dependency(%q<
|
|
95
|
+
s.add_runtime_dependency(%q<textpow1x>, [">= 1"])
|
|
96
96
|
s.add_runtime_dependency(%q<language_sniffer>, [">= 0"])
|
|
97
97
|
else
|
|
98
98
|
s.add_dependency(%q<clipboard>, [">= 0.9.8"])
|
|
99
|
-
s.add_dependency(%q<
|
|
99
|
+
s.add_dependency(%q<textpow1x>, [">= 1"])
|
|
100
100
|
s.add_dependency(%q<language_sniffer>, [">= 0"])
|
|
101
101
|
end
|
|
102
102
|
else
|
|
103
103
|
s.add_dependency(%q<clipboard>, [">= 0.9.8"])
|
|
104
|
-
s.add_dependency(%q<
|
|
104
|
+
s.add_dependency(%q<textpow1x>, [">= 1"])
|
|
105
105
|
s.add_dependency(%q<language_sniffer>, [">= 0"])
|
|
106
106
|
end
|
|
107
107
|
end
|
data/spec/ruco/editor_spec.rb
CHANGED
|
@@ -631,14 +631,14 @@ describe Ruco::Editor do
|
|
|
631
631
|
end
|
|
632
632
|
|
|
633
633
|
it "shows multi-line selection in scrolled space" do
|
|
634
|
-
write("\n\n\n\n\
|
|
634
|
+
write("\n\n\n\n\nacdefghijk\nacdefghijk\nacdefghijk\n\n")
|
|
635
635
|
ta = editor.send(:text_area)
|
|
636
636
|
ta.send(:position=, [5,8])
|
|
637
637
|
ta.send(:screen_position=, [5,7])
|
|
638
638
|
editor.selecting do
|
|
639
639
|
move(:relative, 2, 1)
|
|
640
640
|
end
|
|
641
|
-
editor.view.should == "
|
|
641
|
+
editor.view.should == "ijk\nijk\nijk"
|
|
642
642
|
editor.cursor.should == [2,2]
|
|
643
643
|
editor.style_map.flatten.should == [
|
|
644
644
|
[nil, :reverse, nil, nil, nil, :normal], # start to end of screen
|
|
@@ -668,6 +668,18 @@ describe Ruco::Editor do
|
|
|
668
668
|
]
|
|
669
669
|
end
|
|
670
670
|
|
|
671
|
+
it "shows mid-keywords for moved window" do
|
|
672
|
+
write("\n\n\n\n\nclass ")
|
|
673
|
+
editor.move(:to, 5, 6)
|
|
674
|
+
editor.cursor.should == [1,3]
|
|
675
|
+
editor.view.should == "\nss \n"
|
|
676
|
+
editor.style_map.flatten.should == [
|
|
677
|
+
nil,
|
|
678
|
+
[color(:keyword), nil, :normal],
|
|
679
|
+
nil
|
|
680
|
+
]
|
|
681
|
+
end
|
|
682
|
+
|
|
671
683
|
it "shows multiple syntax elements" do
|
|
672
684
|
write("if @x")
|
|
673
685
|
editor.style_map.flatten.should == [
|
|
@@ -16,7 +16,7 @@ describe Ruco::StatusBar do
|
|
|
16
16
|
it "can show to long files" do
|
|
17
17
|
editor = Ruco::Editor.new('123456789abcdefghijklmnop', :lines => 5, :columns => 20)
|
|
18
18
|
bar = Ruco::StatusBar.new(editor, :columns => 30)
|
|
19
|
-
bar.view.should == "Ruco #{Ruco::VERSION} --
|
|
19
|
+
bar.view.should == "Ruco #{Ruco::VERSION} -- 1234...nop 1:1"
|
|
20
20
|
bar.view.size.should == 30
|
|
21
21
|
end
|
|
22
22
|
|
data/spec/ruco_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -5,7 +5,11 @@ require 'ruco'
|
|
|
5
5
|
require 'timeout'
|
|
6
6
|
require 'tempfile'
|
|
7
7
|
|
|
8
|
-
silence_warnings
|
|
8
|
+
silence_warnings do
|
|
9
|
+
Ruco::Editor::Colors::DEFAULT_THEME = 'spec/fixtures/test.tmTheme'
|
|
10
|
+
Ruco::OLD_VERSION = Ruco::VERSION
|
|
11
|
+
Ruco::VERSION = '0.0.0' # so tests dont fail if version gets longer
|
|
12
|
+
end
|
|
9
13
|
|
|
10
14
|
class Tempfile
|
|
11
15
|
def self.string_as_file(data)
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruco
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 62196369
|
|
5
5
|
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
9
|
- 0
|
|
10
10
|
- beta
|
|
11
|
-
-
|
|
12
|
-
version: 0.2.0.
|
|
11
|
+
- 9
|
|
12
|
+
version: 0.2.0.beta9
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Michael Grosser
|
|
@@ -17,7 +17,7 @@ autorequire:
|
|
|
17
17
|
bindir: bin
|
|
18
18
|
cert_chain: []
|
|
19
19
|
|
|
20
|
-
date: 2011-
|
|
20
|
+
date: 2011-10-02 00:00:00 +02:00
|
|
21
21
|
default_executable: ruco
|
|
22
22
|
dependencies:
|
|
23
23
|
- !ruby/object:Gem::Dependency
|
|
@@ -42,13 +42,13 @@ dependencies:
|
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
hash:
|
|
45
|
+
hash: 1
|
|
46
46
|
segments:
|
|
47
|
-
-
|
|
48
|
-
version: "
|
|
47
|
+
- 1
|
|
48
|
+
version: "1"
|
|
49
49
|
requirement: *id002
|
|
50
50
|
type: :runtime
|
|
51
|
-
name:
|
|
51
|
+
name: textpow1x
|
|
52
52
|
prerelease: false
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|