ruco 0.0.39 → 0.0.40
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 -0
- data/VERSION +1 -1
- data/bin/ruco +2 -0
- data/lib/ruco/application.rb +1 -1
- data/lib/ruco/editor.rb +6 -0
- data/ruco.gemspec +4 -3
- data/spec/ruco/editor_spec.rb +23 -0
- metadata +8 -11
data/Readme.md
CHANGED
@@ -64,6 +64,8 @@ TIPS
|
|
64
64
|
|
65
65
|
TODO
|
66
66
|
=====
|
67
|
+
- strip whitespace after content / whitespace only lines, without removing intentional whitespace e.g. from markdown
|
68
|
+
- handle \\r and \\r\\n nicely <-> breaks curses output
|
67
69
|
- highlight tabs (e.g. strange character or reverse/underline/color)
|
68
70
|
- big warning when editing a not-writable file
|
69
71
|
- find next (Alt+n)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.40
|
data/bin/ruco
CHANGED
@@ -20,6 +20,7 @@ Usage:
|
|
20
20
|
Options:
|
21
21
|
BANNER
|
22
22
|
opts.on("-c", "--convert-tabs","Convert tabs to spaces") { options[:convert_tabs] = true }
|
23
|
+
opts.on("--convert-return","Convert \\r characters to \\n") { options[:convert_return] = true }
|
23
24
|
opts.on("--debug-cache","Show caching in action") { options[:debug_cache] = true }
|
24
25
|
opts.on("--debug-keys", "Show pressed keys") { options[:debug_keys] = true }
|
25
26
|
opts.on("-v", "--version","Show Version"){
|
@@ -121,6 +122,7 @@ require 'ruco'
|
|
121
122
|
|
122
123
|
app = Ruco::Application.new(ARGV[0],
|
123
124
|
:convert_tabs => @options[:convert_tabs],
|
125
|
+
:convert_return => @options[:convert_return],
|
124
126
|
:lines => Curses.stdscr.maxy, :columns => Curses.stdscr.maxx
|
125
127
|
)
|
126
128
|
|
data/lib/ruco/application.rb
CHANGED
@@ -231,7 +231,7 @@ module Ruco
|
|
231
231
|
|
232
232
|
def create_components
|
233
233
|
@status_lines = 1
|
234
|
-
@editor ||= Ruco::Editor.new(@file, :lines => editor_lines, :columns => @options[:columns], :convert_tabs => @options[:convert_tabs])
|
234
|
+
@editor ||= Ruco::Editor.new(@file, :lines => editor_lines, :columns => @options[:columns], :convert_tabs => @options[:convert_tabs], :convert_return => @options[:convert_return])
|
235
235
|
@status = Ruco::StatusBar.new(@editor, :columns => @options[:columns])
|
236
236
|
@command = Ruco::CommandBar.new(:columns => @options[:columns])
|
237
237
|
command.cursor_line = editor_lines
|
data/lib/ruco/editor.rb
CHANGED
@@ -20,6 +20,12 @@ module Ruco
|
|
20
20
|
|
21
21
|
content = (File.exist?(@file) ? File.read(@file) : '')
|
22
22
|
content.tabs_to_spaces! if options[:convert_tabs]
|
23
|
+
|
24
|
+
if options[:convert_return]
|
25
|
+
content.gsub!(/\r\n?/,"\n")
|
26
|
+
else
|
27
|
+
raise "Ruco does not support \\r characters, start with --convert-return to remove them" if content.include?("\r")
|
28
|
+
end
|
23
29
|
|
24
30
|
@saved_content = content
|
25
31
|
@text_area = EditorArea.new(content, options)
|
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.40"
|
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-
|
12
|
+
s.date = %q{2011-02-04}
|
13
13
|
s.default_executable = %q{ruco}
|
14
14
|
s.email = %q{michael@grosser.it}
|
15
15
|
s.executables = ["ruco"]
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
]
|
57
57
|
s.homepage = %q{http://github.com/grosser/ruco}
|
58
58
|
s.require_paths = ["lib"]
|
59
|
-
s.rubygems_version = %q{1.
|
59
|
+
s.rubygems_version = %q{1.3.7}
|
60
60
|
s.summary = %q{Commandline editor written in ruby}
|
61
61
|
s.test_files = [
|
62
62
|
"spec/ruco/application_spec.rb",
|
@@ -75,6 +75,7 @@ Gem::Specification.new do |s|
|
|
75
75
|
]
|
76
76
|
|
77
77
|
if s.respond_to? :specification_version then
|
78
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
78
79
|
s.specification_version = 3
|
79
80
|
|
80
81
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/spec/ruco/editor_spec.rb
CHANGED
@@ -11,6 +11,29 @@ describe Ruco::Editor do
|
|
11
11
|
@file = 'spec/temp.txt'
|
12
12
|
end
|
13
13
|
|
14
|
+
describe "\\r" do
|
15
|
+
it "raises on \r" do
|
16
|
+
write("\r")
|
17
|
+
lambda{editor}.should raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
it "raises on \r\n" do
|
21
|
+
write("\r\n")
|
22
|
+
lambda{editor}.should raise_error
|
23
|
+
end
|
24
|
+
|
25
|
+
it "converts \\r if flag is given" do
|
26
|
+
write("a\nb\rc\r\n")
|
27
|
+
editor = Ruco::Editor.new(@file, :lines => 3, :columns => 5, :convert_return => true)
|
28
|
+
editor.view.should == "a\nb\nc\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "is happy with \n" do
|
32
|
+
write("\n")
|
33
|
+
editor
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
14
37
|
describe 'convert tabs' do
|
15
38
|
before do
|
16
39
|
write("\t\ta")
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 40
|
9
|
+
version: 0.0.40
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Michael Grosser
|
@@ -15,25 +14,24 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-04 00:00:00 +01:00
|
19
18
|
default_executable: ruco
|
20
19
|
dependencies:
|
21
20
|
- !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
|
28
27
|
segments:
|
29
28
|
- 0
|
30
29
|
- 9
|
31
30
|
- 4
|
32
31
|
version: 0.9.4
|
32
|
+
type: :runtime
|
33
33
|
prerelease: false
|
34
34
|
version_requirements: *id001
|
35
|
-
type: :runtime
|
36
|
-
name: clipboard
|
37
35
|
description:
|
38
36
|
email: michael@grosser.it
|
39
37
|
executables:
|
@@ -96,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
94
|
requirements:
|
97
95
|
- - ">="
|
98
96
|
- !ruby/object:Gem::Version
|
99
|
-
hash:
|
97
|
+
hash: -441011373
|
100
98
|
segments:
|
101
99
|
- 0
|
102
100
|
version: "0"
|
@@ -105,14 +103,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
103
|
requirements:
|
106
104
|
- - ">="
|
107
105
|
- !ruby/object:Gem::Version
|
108
|
-
hash: 3
|
109
106
|
segments:
|
110
107
|
- 0
|
111
108
|
version: "0"
|
112
109
|
requirements: []
|
113
110
|
|
114
111
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.3.7
|
116
113
|
signing_key:
|
117
114
|
specification_version: 3
|
118
115
|
summary: Commandline editor written in ruby
|