ruco 0.0.49 → 0.0.50

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/Readme.md CHANGED
@@ -3,7 +3,7 @@ Simple, extendable, test-driven commandline editor written in ruby.
3
3
  Features:
4
4
 
5
5
  - **Intuitive interface**
6
- - selecting via Shift+left/right/up/down (only on Linux) and Ctrl+a(all)
6
+ - selecting via Shift + arrow-keys (Linux only) or 'select mode' Ctrl+b + arrow-keys
7
7
  - move line up/down (Alt+Ctrl+up/down)
8
8
  - Tab -> indent / Shift+Tab -> unindent
9
9
  - keeps indentation (+ paste-detection e.g. via Cmd+v)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.49
1
+ 0.0.50
@@ -29,6 +29,10 @@ module Ruco
29
29
  end
30
30
 
31
31
  def key(key)
32
+ # deactivate select_mode if its not re-enabled in this action
33
+ @select_mode_was_on = @select_mode
34
+ @select_mode = false
35
+
32
36
  if bound = @bindings[key]
33
37
  result = if bound.is_a?(Symbol)
34
38
  @actions[bound].call
@@ -41,14 +45,14 @@ module Ruco
41
45
  case key
42
46
 
43
47
  # move
44
- when :down then @focused.move(:relative, 1,0)
45
- when :right then @focused.move(:relative, 0,1)
46
- when :up then @focused.move(:relative, -1,0)
47
- when :left then @focused.move(:relative, 0,-1)
48
- when :end then @focused.move :to_eol
49
- when :home then @focused.move :to_bol
50
- when :page_up then @focused.move :page_up
51
- when :page_down then @focused.move :page_down
48
+ when :down then move_with_select_mode :relative, 1,0
49
+ when :right then move_with_select_mode :relative, 0,1
50
+ when :up then move_with_select_mode :relative, -1,0
51
+ when :left then move_with_select_mode :relative, 0,-1
52
+ when :end then move_with_select_mode :to_eol
53
+ when :home then move_with_select_mode :to_bol
54
+ when :page_up then move_with_select_mode :page_up
55
+ when :page_down then move_with_select_mode :page_down
52
56
 
53
57
  # select
54
58
  when :"Shift+down" then
@@ -172,6 +176,10 @@ module Ruco
172
176
  editor.delete_line
173
177
  end
174
178
 
179
+ action :select_mode do
180
+ @select_mode = !@select_mode_was_on
181
+ end
182
+
175
183
  action :select_all do
176
184
  @focused.move(:to, 0, 0)
177
185
  @focused.selecting do
@@ -221,6 +229,7 @@ module Ruco
221
229
  bind :"Ctrl+g", :go_to_line
222
230
  bind :"Ctrl+f", :find
223
231
  bind :"Ctrl+r", :find_and_replace
232
+ bind :"Ctrl+b", :select_mode
224
233
  bind :"Ctrl+a", :select_all
225
234
  bind :"Ctrl+d", :delete_line
226
235
  bind :"Ctrl+x", :cut
@@ -272,5 +281,16 @@ module Ruco
272
281
  end
273
282
  [file, go_to_line]
274
283
  end
284
+
285
+ def move_with_select_mode(*args)
286
+ @select_mode = true if @select_mode_was_on
287
+ if @select_mode
288
+ @focused.selecting do
289
+ move(*args)
290
+ end
291
+ else
292
+ @focused.send(:move, *args)
293
+ end
294
+ end
275
295
  end
276
296
  end
data/ruco.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.0.49"
8
+ s.version = "0.0.50"
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-02-20}
12
+ s.date = %q{2011-02-21}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
@@ -63,7 +63,7 @@ Gem::Specification.new do |s|
63
63
  ]
64
64
  s.homepage = %q{http://github.com/grosser/ruco}
65
65
  s.require_paths = ["lib"]
66
- s.rubygems_version = %q{1.3.7}
66
+ s.rubygems_version = %q{1.4.2}
67
67
  s.summary = %q{Commandline editor written in ruby}
68
68
  s.test_files = [
69
69
  "spec/ruco/application_spec.rb",
@@ -85,7 +85,6 @@ Gem::Specification.new do |s|
85
85
  ]
86
86
 
87
87
  if s.respond_to? :specification_version then
88
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
89
88
  s.specification_version = 3
90
89
 
91
90
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -325,6 +325,26 @@ describe Ruco::Application do
325
325
  end
326
326
  end
327
327
 
328
+ describe 'select mode' do
329
+ it "turns move commands into select commands" do
330
+ write('abc')
331
+ type :'Ctrl+b', :right, :right, 'a'
332
+ editor_part(app.view).should == "ac\n\n"
333
+ end
334
+
335
+ it "stops after first non-move command" do
336
+ write('abc')
337
+ type :'Ctrl+b', :right, 'd', :right, 'e'
338
+ editor_part(app.view).should == "dbec\n\n"
339
+ end
340
+
341
+ it "stops after hitting twice" do
342
+ write('abc')
343
+ type :'Ctrl+b', :'Ctrl+b', :right, 'd'
344
+ editor_part(app.view).should == "adbc\n\n"
345
+ end
346
+ end
347
+
328
348
  describe :save do
329
349
  it "just saves" do
330
350
  write('')
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: 123
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 49
9
- version: 0.0.49
9
+ - 50
10
+ version: 0.0.50
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Grosser
@@ -14,24 +15,25 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-02-20 00:00:00 +01:00
18
+ date: 2011-02-21 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:
@@ -101,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
103
  requirements:
102
104
  - - ">="
103
105
  - !ruby/object:Gem::Version
104
- hash: -100213919
106
+ hash: 3
105
107
  segments:
106
108
  - 0
107
109
  version: "0"
@@ -110,13 +112,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
112
  requirements:
111
113
  - - ">="
112
114
  - !ruby/object:Gem::Version
115
+ hash: 3
113
116
  segments:
114
117
  - 0
115
118
  version: "0"
116
119
  requirements: []
117
120
 
118
121
  rubyforge_project:
119
- rubygems_version: 1.3.7
122
+ rubygems_version: 1.4.2
120
123
  signing_key:
121
124
  specification_version: 3
122
125
  summary: Commandline editor written in ruby