daff 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@ module Coopy
12
12
  attr_accessor :category
13
13
  attr_accessor :category_given_tr
14
14
  attr_accessor :separator
15
+ attr_accessor :pretty_separator
15
16
  attr_accessor :updated
16
17
  attr_accessor :conflicted
17
18
  attr_accessor :pvalue
@@ -480,7 +480,7 @@ module Coopy
480
480
  class << self
481
481
  attr_accessor :version
482
482
  end
483
- @version = "1.1.7"
483
+ @version = "1.1.8"
484
484
 
485
485
  def Coopy.compare_tables(local,remote)
486
486
  ct = ::Coopy::CompareTable.new
@@ -45,7 +45,6 @@ module Coopy
45
45
 
46
46
  def render_cell(v,d)
47
47
  return "NULL" if d == nil
48
- return "NULL" if v.equals(d,nil)
49
48
  str = v.to_s(d)
50
49
  delim = ","
51
50
  need_quote = false
@@ -136,6 +136,7 @@ module Coopy
136
136
  cell.category = ""
137
137
  cell.category_given_tr = ""
138
138
  cell.separator = ""
139
+ cell.pretty_separator = ""
139
140
  cell.conflicted = false
140
141
  cell.updated = false
141
142
  cell.pvalue = cell.lvalue = cell.rvalue = nil
@@ -178,6 +179,7 @@ module Coopy
178
179
  end
179
180
  cell.updated = true
180
181
  cell.separator = div
182
+ cell.pretty_separator = div
181
183
  if cell.pretty_value == div
182
184
  tokens = ["",""]
183
185
  else
@@ -193,7 +195,8 @@ module Coopy
193
195
  pretty_tokens[0] = ::Coopy::DiffRender.mark_spaces(ref,tokens[2])
194
196
  pretty_tokens[2] = ::Coopy::DiffRender.mark_spaces(tokens[2],ref)
195
197
  end
196
- cell.pretty_value = pretty_tokens.join([8594].pack("U"))
198
+ cell.pretty_separator = [8594].pack("U")
199
+ cell.pretty_value = pretty_tokens.join(cell.pretty_separator)
197
200
  cell.category_given_tr = cell.category = cat
198
201
  offset = nil
199
202
  if cell.conflicted
@@ -17,10 +17,12 @@ module Coopy
17
17
  tt = ::Coopy::TableText.new(t)
18
18
  codes = {}
19
19
  codes["header"] = "\x1B[0;1m"
20
+ codes["spec"] = "\x1B[35;1m"
20
21
  codes["add"] = "\x1B[32;1m"
21
22
  codes["conflict"] = "\x1B[33;1m"
22
23
  codes["modify"] = "\x1B[34;1m"
23
24
  codes["remove"] = "\x1B[31;1m"
25
+ codes["minor"] = "\x1B[2m"
24
26
  codes["done"] = "\x1B[0m"
25
27
  begin
26
28
  _g = 0
@@ -32,17 +34,22 @@ module Coopy
32
34
  while(_g1 < w)
33
35
  x = _g1
34
36
  _g1+=1
35
- txt += "," if x > 0
37
+ txt += _hx_str(codes["minor"]) + "," + _hx_str(codes["done"]) if x > 0
36
38
  val = tt.get_cell_text(x,y)
37
39
  val = "" if val == nil
38
40
  cell = ::Coopy::DiffRender.render_cell(tt,x,y)
39
41
  code = nil
40
42
  code = codes[cell.category] if cell.category != nil
43
+ if cell.category_given_tr != nil
44
+ code_tr = codes[cell.category_given_tr]
45
+ code = code_tr if code_tr != nil
46
+ end
41
47
  if code != nil
42
48
  if cell.rvalue != nil
43
- val = _hx_str(codes["remove"]) + _hx_str(cell.lvalue) + _hx_str(codes["modify"]) + _hx_str(cell.separator) + _hx_str(codes["add"]) + _hx_str(cell.rvalue) + _hx_str(codes["done"])
44
- val = _hx_str(codes["conflict"]) + _hx_str(cell.pvalue) + _hx_str(codes["modify"]) + _hx_str(cell.separator) + _hx_str(val) if cell.pvalue != nil
49
+ val = _hx_str(codes["remove"]) + _hx_str(cell.lvalue) + _hx_str(codes["modify"]) + _hx_str(cell.pretty_separator) + _hx_str(codes["add"]) + _hx_str(cell.rvalue) + _hx_str(codes["done"])
50
+ val = _hx_str(codes["conflict"]) + _hx_str(cell.pvalue) + _hx_str(codes["modify"]) + _hx_str(cell.pretty_separator) + _hx_str(val) if cell.pvalue != nil
45
51
  else
52
+ val = cell.pretty_value
46
53
  val = _hx_str(code) + _hx_str(val) + _hx_str(codes["done"])
47
54
  end
48
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-17 00:00:00.000000000 Z
13
+ date: 2014-07-18 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Diff and patch tables
16
16
  email: