ruco 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -84,7 +84,6 @@ TIPS
84
84
  TODO
85
85
  =====
86
86
  - do not fall back to 0:0 after undoing the first change
87
- - slow when opening file with 10,000+ short lines -> investigate
88
87
  - check writable status every x seconds (e.g. in background) -> faster while typing
89
88
  - search help e.g. 'Nothing found' '#4 of 6 hits' 'no more hits, start from beginning ?'
90
89
  - highlight current work when reopening search (so typing replaces it)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
@@ -1,15 +1,13 @@
1
1
  class String
2
+ # fix strange string split behavior without cluttering the knowledge
3
+ # all over the codebase
4
+ # " ".split(' ') == []
5
+ # " ".split(/ /) == []
6
+ # " ".split(' ',-1) == ['']
7
+ # " ".naive_split(' ') == ['','','','']
2
8
  def naive_split(pattern)
3
- string = self.dup
4
- found = []
5
-
6
- while position = string.index(pattern)
7
- found << string.slice!(0, position)
8
- string.slice!(0,[pattern.size,1].max)
9
- end
10
-
11
- found << string
12
- found
9
+ result = split(/#{pattern}/, -1)
10
+ result.empty? ? [''] : result
13
11
  end
14
12
 
15
13
  def tabs_to_spaces!
@@ -296,7 +296,7 @@ module Ruco
296
296
  if replace_surrounding_chars
297
297
  selected = selected[1..-2]
298
298
  else
299
- old_selection.last.column += 2
299
+ old_selection.last.column += (selected.include?("\n") ? 1 : 2)
300
300
  end
301
301
 
302
302
  insert("#{open_char}#{selected}#{close_char}")
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-08-25}
12
+ s.date = %q{2011-08-28}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
@@ -13,6 +13,10 @@ describe String do
13
13
  it "splits empty into 1" do
14
14
  "".naive_split('a').should == ['']
15
15
  end
16
+
17
+ it "splits 1 into 2" do
18
+ "a".naive_split('a').should == ['','']
19
+ end
16
20
  end
17
21
 
18
22
  describe :surrounded_in? do
@@ -148,6 +148,15 @@ describe Ruco::TextArea do
148
148
  text.view.should == "'bar'\n\n"
149
149
  text.selection.should == ([0,0]..[0,5])
150
150
  end
151
+
152
+ it "surrounds across lines" do
153
+ text.insert("ab\ncd\nef")
154
+ text.move(:to, 0,0)
155
+ text.selecting{ move(:to, 1,0) }
156
+ text.insert("'")
157
+ text.view.should == "'ab\n'cd\nef"
158
+ text.selection.should == ([0,0]..[1,1])
159
+ end
151
160
  end
152
161
  end
153
162
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 11
10
- version: 0.1.11
9
+ - 12
10
+ version: 0.1.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-25 00:00:00 +02:00
18
+ date: 2011-08-28 00:00:00 +02:00
19
19
  default_executable: ruco
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency