ruco 0.2.0.beta9 → 0.2.0.beta10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/ruco/editor/colors.rb +16 -6
  3. data/ruco.gemspec +1 -1
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.beta9
1
+ 0.2.0.beta10
@@ -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
- columns = columns.move(-@window.left)
55
- columns = 0...columns.last if columns.first < 0 and columns.last > 0
56
- style = style_for_syntax_element(syntax_element)
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.2.0.beta9"
8
+ s.version = "0.2.0.beta10"
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"]
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: 62196369
4
+ hash: 62196375
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 9
12
- version: 0.2.0.beta9
11
+ - 10
12
+ version: 0.2.0.beta10
13
13
  platform: ruby
14
14
  authors:
15
15
  - Michael Grosser