ruco 0.2.0.beta9 → 0.2.0.beta10
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/VERSION +1 -1
- data/lib/ruco/editor/colors.rb +16 -6
- data/ruco.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.0.
|
|
1
|
+
0.2.0.beta10
|
data/lib/ruco/editor/colors.rb
CHANGED
|
@@ -50,17 +50,27 @@ module Ruco
|
|
|
50
50
|
def add_syntax_highlighting_to_style_map(map, syntax_info)
|
|
51
51
|
syntax_info.each_with_index do |syntax_positions, line|
|
|
52
52
|
next unless syntax_positions
|
|
53
|
+
|
|
53
54
|
syntax_positions.each do |syntax_element, columns|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
style
|
|
57
|
-
if style and columns.first >= 0
|
|
58
|
-
map.add(style, line, columns)
|
|
59
|
-
end
|
|
55
|
+
next unless style = style_for_syntax_element(syntax_element)
|
|
56
|
+
next unless columns = adjust_columns_to_window_position(columns, @window.left)
|
|
57
|
+
map.add(style, line, columns)
|
|
60
58
|
end
|
|
61
59
|
end
|
|
62
60
|
end
|
|
63
61
|
|
|
62
|
+
def adjust_columns_to_window_position(columns, left)
|
|
63
|
+
return columns if left == 0
|
|
64
|
+
|
|
65
|
+
# style is out of scope -> add nothing
|
|
66
|
+
return nil if columns.last_element <= left
|
|
67
|
+
|
|
68
|
+
# shift style to the left
|
|
69
|
+
first = [0, columns.first - left].max
|
|
70
|
+
last = columns.last_element - left
|
|
71
|
+
first..last
|
|
72
|
+
end
|
|
73
|
+
|
|
64
74
|
def style_for_syntax_element(syntax_element)
|
|
65
75
|
@style_for_element ||= {}
|
|
66
76
|
@style_for_element[syntax_element] ||= begin
|
data/ruco.gemspec
CHANGED
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: 62196375
|
|
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
|
+
- 10
|
|
12
|
+
version: 0.2.0.beta10
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Michael Grosser
|