ruco 0.0.53 → 0.0.54
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 +2 -2
- data/VERSION +1 -1
- data/lib/ruco/command_bar.rb +5 -1
- data/lib/ruco/editor.rb +1 -1
- data/lib/ruco/status_bar.rb +11 -7
- data/lib/ruco/text_area.rb +2 -2
- data/ruco.gemspec +2 -2
- data/spec/ruco/application_spec.rb +6 -3
- data/spec/ruco/command_bar_spec.rb +9 -0
- data/spec/ruco/status_bar_spec.rb +5 -1
- metadata +4 -4
data/Readme.md
CHANGED
@@ -81,9 +81,9 @@ TIPS
|
|
81
81
|
|
82
82
|
TODO
|
83
83
|
=====
|
84
|
-
- check
|
84
|
+
- check writable status every x seconds (e.g. in background) -> faster while typing
|
85
85
|
- search help e.g. 'Nothing found' '#4 of 6 hits' 'no more hits, start from beginning ?'
|
86
|
-
-
|
86
|
+
- highlight current work when reopening search (so typing replaces it)
|
87
87
|
- align soft-tabs
|
88
88
|
- highlight tabs (e.g. strange character or reverse/underline/color)
|
89
89
|
- big warning when editing a not-writable file
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.54
|
data/lib/ruco/command_bar.rb
CHANGED
@@ -65,7 +65,11 @@ module Ruco
|
|
65
65
|
def cached_form_if(cache, question)
|
66
66
|
if cache
|
67
67
|
new_form = yield
|
68
|
-
|
68
|
+
if @forms_cache[question]
|
69
|
+
new_form.insert(@forms_cache[question].value)
|
70
|
+
new_form.move(:to, 0,0)
|
71
|
+
new_form.selecting{ move(:to_eol) }
|
72
|
+
end
|
69
73
|
@forms_cache[question] = new_form
|
70
74
|
else
|
71
75
|
yield
|
data/lib/ruco/editor.rb
CHANGED
@@ -3,7 +3,7 @@ module Ruco
|
|
3
3
|
attr_reader :file
|
4
4
|
attr_reader :text_area
|
5
5
|
private :text_area
|
6
|
-
delegate :view, :style_map, :cursor,
|
6
|
+
delegate :view, :style_map, :cursor, :position,
|
7
7
|
:insert, :indent, :unindent, :delete, :delete_line,
|
8
8
|
:redo, :undo,
|
9
9
|
:selecting, :selection, :text_in_selection, :reset,
|
data/lib/ruco/status_bar.rb
CHANGED
@@ -6,11 +6,8 @@ module Ruco
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def view
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def format
|
13
|
-
Curses::A_REVERSE
|
9
|
+
position = @editor.position
|
10
|
+
spread "Ruco #{Ruco::VERSION} -- #{@editor.file}#{change_indicator}#{writable_indicator}", "#{position.line + 1}:#{position.column + 1}"
|
14
11
|
end
|
15
12
|
|
16
13
|
def change_indicator
|
@@ -18,10 +15,17 @@ module Ruco
|
|
18
15
|
end
|
19
16
|
|
20
17
|
def writable_indicator
|
21
|
-
@
|
18
|
+
@writable ||= begin
|
22
19
|
writable = (not File.exist?(@editor.file) or system("test -w #{@editor.file}"))
|
23
20
|
writable ? ' ' : '!'
|
24
21
|
end
|
25
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def spread(left, right)
|
27
|
+
empty = [@options[:columns] - left.size - right.size, 0].max
|
28
|
+
"#{left}#{' ' * empty}#{right}"
|
29
|
+
end
|
26
30
|
end
|
27
|
-
end
|
31
|
+
end
|
data/lib/ruco/text_area.rb
CHANGED
@@ -123,12 +123,12 @@ module Ruco
|
|
123
123
|
@window.columns = columns
|
124
124
|
end
|
125
125
|
|
126
|
-
protected
|
127
|
-
|
128
126
|
def position
|
129
127
|
Position.new(line, column)
|
130
128
|
end
|
131
129
|
|
130
|
+
protected
|
131
|
+
|
132
132
|
def position_for_index(index)
|
133
133
|
jump = content.slice(0, index).to_s.naive_split("\n")
|
134
134
|
[jump.size - 1, jump.last.size]
|
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.
|
8
|
+
s.version = "0.0.54"
|
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-05-
|
12
|
+
s.date = %q{2011-05-08}
|
13
13
|
s.default_executable = %q{ruco}
|
14
14
|
s.email = %q{michael@grosser.it}
|
15
15
|
s.executables = ["ruco"]
|
@@ -30,9 +30,12 @@ describe Ruco::Application do
|
|
30
30
|
keys.each{|k| app.key k }
|
31
31
|
end
|
32
32
|
|
33
|
+
def status(line=1)
|
34
|
+
"Ruco #{Ruco::VERSION} -- spec/temp.txt #{line}:1\n"
|
35
|
+
end
|
36
|
+
|
33
37
|
let(:rucorc){ 'spec/.ruco.rb' }
|
34
38
|
let(:app){ Ruco::Application.new(@file, :lines => 5, :columns => 10, :rc => rucorc) }
|
35
|
-
let(:status){ "Ruco #{Ruco::VERSION} -- spec/temp.txt \n" }
|
36
39
|
let(:command){ "^W Exit" }
|
37
40
|
|
38
41
|
it "renders status + editor + command" do
|
@@ -46,7 +49,7 @@ describe Ruco::Application do
|
|
46
49
|
app.key(:enter)
|
47
50
|
app.key('2')
|
48
51
|
app.key(:enter)
|
49
|
-
app.view.should == "#{status.sub('.txt ','.txt*')}2\n\n\n#{command}"
|
52
|
+
app.view.should == "#{status(3).sub('.txt ','.txt*')}2\n\n\n#{command}"
|
50
53
|
end
|
51
54
|
|
52
55
|
it "does not enter key-codes" do
|
@@ -59,7 +62,7 @@ describe Ruco::Application do
|
|
59
62
|
app.key(:"Ctrl+g") # go to line
|
60
63
|
app.key('2') # 2
|
61
64
|
app.key(:enter)
|
62
|
-
app.view.should == "#{status}123\n456\n789\n#{command}"
|
65
|
+
app.view.should == "#{status(2)}123\n456\n789\n#{command}"
|
63
66
|
app.cursor.should == [2,0] # 0 offset + 1 for statusbar
|
64
67
|
end
|
65
68
|
|
@@ -75,6 +75,15 @@ describe Ruco::CommandBar do
|
|
75
75
|
bar.view.should == "Find: abc"
|
76
76
|
end
|
77
77
|
|
78
|
+
it "selects last value on cache-hit so I can type for new value" do
|
79
|
+
bar.ask('Find: ', :cache => true){}
|
80
|
+
bar.insert('abc')
|
81
|
+
bar.insert("\n")
|
82
|
+
bar.ask('Find: ', :cache => true){}
|
83
|
+
bar.cursor.column.should == 9
|
84
|
+
bar.text_in_selection.should == 'abc'
|
85
|
+
end
|
86
|
+
|
78
87
|
it "gets reset when starting a new question" do
|
79
88
|
bar.ask('Find: '){}
|
80
89
|
bar.insert('123')
|
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:
|
4
|
+
hash: 115
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 54
|
10
|
+
version: 0.0.54
|
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-05-
|
18
|
+
date: 2011-05-08 00:00:00 +02:00
|
19
19
|
default_executable: ruco
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|