ruco 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -24,7 +24,6 @@ Usage
24
24
  TODO
25
25
  =====
26
26
  - support typing unicode like äöß etc (rework size / make strings utf8-aware)
27
- - ask before quitting on changed file
28
27
  - bind/action must use instance_exec
29
28
  - read .rucorc.rb
30
29
  - write key binding guide
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -86,7 +86,13 @@ module Ruco
86
86
  end
87
87
 
88
88
  action :quit do
89
- :quit
89
+ if @editor.modified?
90
+ ask("Loose changes? Enter=Yes Esc=Cancel") do
91
+ :quit
92
+ end
93
+ else
94
+ :quit
95
+ end
90
96
  end
91
97
 
92
98
  action :go_to_line do
@@ -16,6 +16,7 @@ module Ruco
16
16
  end
17
17
 
18
18
  def view
19
+ lines = self.lines
19
20
  Array.new(@options[:lines]).map_with_index do |_,i|
20
21
  (lines[i + @scrolled_lines] || "").slice(@scrolled_columns, @options[:columns])
21
22
  end * "\n" + "\n"
@@ -79,7 +80,7 @@ module Ruco
79
80
  lines[@line].size
80
81
  end
81
82
 
82
- private
83
+ protected
83
84
 
84
85
  def move_to_eol
85
86
  after_last_word = current_line.index(/\s*$/)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.0.9"
8
+ s.version = "0.0.10"
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-01-13}
12
+ s.date = %q{2011-01-14}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
@@ -37,9 +37,26 @@ describe Ruco::Application do
37
37
  app.cursor.should == [3,0] # 0 offset + 1 for statusbar
38
38
  end
39
39
 
40
- it "can quit" do
41
- result = app.key(:"Ctrl+w")
42
- result.should == :quit
40
+ describe 'closing' do
41
+ it "can quit" do
42
+ result = app.key(:"Ctrl+w")
43
+ result.should == :quit
44
+ end
45
+
46
+ it "asks before closing changed file -- escape == no" do
47
+ app.key(?a)
48
+ app.key(:"Ctrl+w")
49
+ app.view.split("\n").last.should include("Loose changes")
50
+ app.key(:escape).should_not == :quit
51
+ app.key("\n").should_not == :quit
52
+ end
53
+
54
+ it "asks before closing changed file -- enter == yes" do
55
+ app.key(?a)
56
+ app.key(:"Ctrl+w")
57
+ app.view.split("\n").last.should include("Loose changes")
58
+ app.key(:enter).should == :quit
59
+ end
43
60
  end
44
61
 
45
62
  describe :bind do
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: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
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-01-13 00:00:00 +01:00
18
+ date: 2011-01-14 00:00:00 +01:00
19
19
  default_executable: ruco
20
20
  dependencies: []
21
21