ruco 0.0.18 → 0.0.19
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/lib/ruco/text_area.rb +6 -7
- data/ruco.gemspec +1 -1
- data/spec/ruco/application_spec.rb +9 -1
- metadata +3 -3
data/Readme.md
CHANGED
@@ -60,6 +60,8 @@ TIPS
|
|
60
60
|
|
61
61
|
TODO
|
62
62
|
=====
|
63
|
+
- session storage (stay at same line/column when reopening)
|
64
|
+
- past detection ? (ctrl+shift+insert / Cmd+v) -> no indentation
|
63
65
|
- selecting -> delete / overwrite / copy / cut
|
64
66
|
- smart staying at end of line/column when changing line
|
65
67
|
- warnings / messages
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.19
|
data/lib/ruco/text_area.rb
CHANGED
@@ -49,8 +49,8 @@ module Ruco
|
|
49
49
|
|
50
50
|
def insert(text)
|
51
51
|
text = tabs_to_spaces(text)
|
52
|
-
if text == "\n"
|
53
|
-
current_whitespace =
|
52
|
+
if text == "\n" and @column >= after_last_word
|
53
|
+
current_whitespace = current_line.match(/^\s*/)[0]
|
54
54
|
next_whitespace = lines[@line+1].to_s.match(/^\s*/)[0]
|
55
55
|
text = text + [current_whitespace, next_whitespace].max
|
56
56
|
end
|
@@ -70,7 +70,7 @@ module Ruco
|
|
70
70
|
def delete_line
|
71
71
|
old_position = position
|
72
72
|
move :to_column, 0
|
73
|
-
delete
|
73
|
+
delete current_line.size
|
74
74
|
if position == [0,0]
|
75
75
|
delete(1)
|
76
76
|
else
|
@@ -96,8 +96,8 @@ module Ruco
|
|
96
96
|
|
97
97
|
protected
|
98
98
|
|
99
|
-
def
|
100
|
-
|
99
|
+
def after_last_word
|
100
|
+
current_line.index(/\s*$/)
|
101
101
|
end
|
102
102
|
|
103
103
|
def position
|
@@ -105,7 +105,6 @@ module Ruco
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def move_to_eol
|
108
|
-
after_last_word = current_line.index(/\s*$/)
|
109
108
|
after_last_whitespace = current_line.size
|
110
109
|
|
111
110
|
if @column == after_last_whitespace or @column < after_last_word
|
@@ -142,7 +141,7 @@ module Ruco
|
|
142
141
|
|
143
142
|
def adjust_view
|
144
143
|
@line = [[@line, 0].max, lines.size - 1].min
|
145
|
-
@column = [[@column, 0].max,
|
144
|
+
@column = [[@column, 0].max, current_line.size].min
|
146
145
|
reposition_cursor
|
147
146
|
scroll_column_into_view
|
148
147
|
scroll_line_into_view
|
data/ruco.gemspec
CHANGED
@@ -125,13 +125,21 @@ describe Ruco::Application do
|
|
125
125
|
editor_part(app.view).should == " \n a\n"
|
126
126
|
end
|
127
127
|
|
128
|
-
it "indents when
|
128
|
+
it "indents when at end of line and the next line has more whitespace" do
|
129
129
|
write("a\n b\n")
|
130
130
|
app.key(:right)
|
131
131
|
app.key(:enter)
|
132
132
|
app.key('c')
|
133
133
|
editor_part(app.view).should == "a\n c\n b"
|
134
134
|
end
|
135
|
+
|
136
|
+
it "does not indent when inside line and next line has more whitespace" do
|
137
|
+
write("ab\n b\n")
|
138
|
+
app.key(:right)
|
139
|
+
app.key(:enter)
|
140
|
+
app.key('c')
|
141
|
+
editor_part(app.view).should == "a\ncb\n b"
|
142
|
+
end
|
135
143
|
end
|
136
144
|
|
137
145
|
describe '.ruco.rb' 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:
|
4
|
+
hash: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 19
|
10
|
+
version: 0.0.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|