ruco 0.0.33 → 0.0.34

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -58,12 +58,13 @@ TIPS
58
58
 
59
59
  TODO
60
60
  =====
61
- - a = replace all
62
- - limit possible file size to e.g. 1MB (would hang/be too slow with insanely big files)
61
+ - make modified smarter <-> no manual addition of every action
62
+ - make history more efficient (e.g. no need to check when only moving / store only diffs)
63
+ - limit possible file size to e.g. 1MB (would hang/be too slow with big files)
63
64
  - find next (Alt+n)
64
65
  - add selection colors to forms in command_bar
65
66
  - session storage (stay at same line/column when reopening)
66
- - smart staying at end of line/column when changing line
67
+ - smart staying at column when changing line
67
68
  - warnings / messages
68
69
  - syntax highlighting
69
70
  - raise when binding to a unsupported key
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.33
1
+ 0.0.34
@@ -177,12 +177,19 @@ module Ruco
177
177
  ask("Find: ", :cache => true) do |term|
178
178
  if editor.find(term)
179
179
  ask("Replace with: ", :cache => true) do |replace|
180
- loop_ask("Replace=Enter Skip=s Cancel=Esc") do |ok|
181
- if ok == '' # enter
180
+ loop_ask("Replace=Enter Skip=s All=a Cancel=Esc") do |ok|
181
+ case ok
182
+ when '' # enter
182
183
  editor.insert(replace)
183
- elsif ok != 's'
184
+ when 'a'
185
+ stop = true
186
+ editor.insert(replace)
187
+ editor.insert(replace) while editor.find(term)
188
+ when 's' # do nothing
189
+ else
184
190
  stop = true
185
191
  end
192
+
186
193
  :finished if stop or not editor.find(term)
187
194
  end
188
195
  end
data/lib/ruco/editor.rb CHANGED
@@ -5,7 +5,7 @@ module Ruco
5
5
  private :text_area
6
6
  delegate :view, :color_mask, :cursor,
7
7
  :selecting, :selection, :text_in_selection, :reset,
8
- :move, :resize, :undo, :redo,
8
+ :move, :resize,
9
9
  :to => :text_area
10
10
 
11
11
  def initialize(file, options)
@@ -31,29 +31,13 @@ module Ruco
31
31
  true
32
32
  end
33
33
 
34
- def insert(text)
35
- text_area.insert(text)
36
- @modified = true
37
- end
38
-
39
- def indent(*args)
40
- text_area.indent(*args)
41
- @modified = true
42
- end
43
-
44
- def unindent(*args)
45
- text_area.unindent(*args)
46
- @modified = true
47
- end
48
-
49
- def delete(*args)
50
- text_area.delete(*args)
51
- @modified = true
52
- end
53
-
54
- def delete_line(*args)
55
- text_area.delete_line(*args)
56
- @modified = true
34
+ %w[insert indent unindent delete delete_line redo undo].each do |modifying|
35
+ eval <<-RUBY
36
+ def #{modifying}(*args)
37
+ text_area.#{modifying}(*args)
38
+ @modified = true
39
+ end
40
+ RUBY
57
41
  end
58
42
 
59
43
  def modified?
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.0.33"
8
+ s.version = "0.0.34"
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"]
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
54
54
  ]
55
55
  s.homepage = %q{http://github.com/grosser/ruco}
56
56
  s.require_paths = ["lib"]
57
- s.rubygems_version = %q{1.3.7}
57
+ s.rubygems_version = %q{1.4.2}
58
58
  s.summary = %q{Commandline editor written in ruby}
59
59
  s.test_files = [
60
60
  "spec/ruco/application_spec.rb",
@@ -72,7 +72,6 @@ Gem::Specification.new do |s|
72
72
  ]
73
73
 
74
74
  if s.respond_to? :specification_version then
75
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
76
75
  s.specification_version = 3
77
76
 
78
77
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -138,6 +138,19 @@ describe Ruco::Application do
138
138
  editor_part(app.view).should == "xabac\n\n"
139
139
  end
140
140
 
141
+ it "can replace all" do
142
+ write '_a_a_a_a'
143
+ type :"Ctrl+r", 'a', :enter
144
+ app.view.should include("Replace with:")
145
+ type 'd', :enter
146
+ app.view.should include("Replace")
147
+ type 's', :enter # skip first
148
+ app.view.should include("Replace")
149
+ type 'a', :enter # all
150
+ app.view.should_not include("Replace")
151
+ editor_part(app.view).should == "_a_d_d_d\n\n"
152
+ end
153
+
141
154
  it "breaks if neither s nor enter is entered" do
142
155
  write 'xabac'
143
156
  type :"Ctrl+r", 'a', :enter
@@ -593,11 +593,30 @@ describe Ruco::Editor do
593
593
  it "removes selection on undo" do
594
594
  editor.insert('a')
595
595
  editor.selecting{move(:to, 1,1)}
596
- editor.selection.should != nil
596
+ editor.selection.should_not == nil
597
597
  editor.view # trigger save point
598
598
  editor.undo
599
599
  editor.selection.should == nil
600
600
  end
601
+
602
+ it "sets modified on undo" do
603
+ editor.insert('a')
604
+ editor.view # trigger save point
605
+ editor.save
606
+ editor.modified?.should == false
607
+ editor.undo
608
+ editor.modified?.should == true
609
+ end
610
+
611
+ it "sets modified on undo" do
612
+ editor.insert('a')
613
+ editor.view # trigger save point
614
+ editor.undo
615
+ editor.save
616
+ editor.modified?.should == false
617
+ editor.redo
618
+ editor.modified?.should == true
619
+ end
601
620
  end
602
621
 
603
622
  describe :save do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 91
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 33
9
- version: 0.0.33
9
+ - 34
10
+ version: 0.0.34
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Grosser
@@ -18,20 +19,21 @@ date: 2011-01-28 00:00:00 +01:00
18
19
  default_executable: ruco
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: clipboard
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
+ hash: 51
27
28
  segments:
28
29
  - 0
29
30
  - 9
30
31
  - 4
31
32
  version: 0.9.4
32
- type: :runtime
33
33
  prerelease: false
34
34
  version_requirements: *id001
35
+ type: :runtime
36
+ name: clipboard
35
37
  description:
36
38
  email: michael@grosser.it
37
39
  executables:
@@ -92,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
94
  requirements:
93
95
  - - ">="
94
96
  - !ruby/object:Gem::Version
95
- hash: -1049918031
97
+ hash: 3
96
98
  segments:
97
99
  - 0
98
100
  version: "0"
@@ -101,13 +103,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
103
  requirements:
102
104
  - - ">="
103
105
  - !ruby/object:Gem::Version
106
+ hash: 3
104
107
  segments:
105
108
  - 0
106
109
  version: "0"
107
110
  requirements: []
108
111
 
109
112
  rubyforge_project:
110
- rubygems_version: 1.3.7
113
+ rubygems_version: 1.4.2
111
114
  signing_key:
112
115
  specification_version: 3
113
116
  summary: Commandline editor written in ruby