rfd 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rfd.rb +40 -37
- data/lib/rfd/commands.rb +2 -2
- data/lib/rfd/windows.rb +68 -170
- data/rfd.gemspec +1 -1
- data/spec/controller_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c84b042ee4196d959b2aa91af8c59ca9fa3b28b
|
4
|
+
data.tar.gz: 46504bdc73c1b0f8a1779955f455e09fe73bc06a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 538534dad4ea1aadd91e06c02ad6ed31b794e25de2460f4329120e7a1988bded79d7086eb8983d479302db4a9e0d751d68129f3e73ad2238fdf80c25a141bca1
|
7
|
+
data.tar.gz: b15391a9ca20f6a2d171542fd0fa3aa92f077471cc43d963ab6182fe75146e9607315a6d7f08710381e04fd21ab059040504a193c1c1840e2c1b09105812d330
|
data/lib/rfd.rb
CHANGED
@@ -34,6 +34,7 @@ module Rfd
|
|
34
34
|
def self.start(dir = '.')
|
35
35
|
init_curses
|
36
36
|
Rfd::Window.draw_borders
|
37
|
+
Curses.refresh
|
37
38
|
rfd = Rfd::Controller.new
|
38
39
|
rfd.cd dir
|
39
40
|
rfd
|
@@ -50,6 +51,7 @@ module Rfd
|
|
50
51
|
@header_l = HeaderLeftWindow.new
|
51
52
|
@header_r = HeaderRightWindow.new
|
52
53
|
@command_line = CommandLineWindow.new
|
54
|
+
@debug = DebugWindow.new if ENV['DEBUG']
|
53
55
|
@direction, @dir_history, @last_command, @times, @yanked_items = nil, [], nil, nil, nil
|
54
56
|
end
|
55
57
|
|
@@ -58,12 +60,12 @@ module Rfd
|
|
58
60
|
loop do
|
59
61
|
begin
|
60
62
|
number_pressed = false
|
61
|
-
case (c = Curses.getch)
|
63
|
+
case (c = Curses.getch)
|
62
64
|
when 10, 13 # enter, return
|
63
65
|
enter
|
64
|
-
when 27
|
66
|
+
when 27 # ESC
|
65
67
|
q
|
66
|
-
when
|
68
|
+
when ' ' # space
|
67
69
|
space
|
68
70
|
when 127 # DEL
|
69
71
|
del
|
@@ -78,12 +80,12 @@ module Rfd
|
|
78
80
|
when Curses::KEY_CTRL_A..Curses::KEY_CTRL_Z
|
79
81
|
chr = ((c - 1 + 65) ^ 0b0100000).chr
|
80
82
|
public_send "ctrl_#{chr}" if respond_to?("ctrl_#{chr}")
|
81
|
-
when
|
82
|
-
public_send c
|
83
|
+
when ?0..?9
|
84
|
+
public_send c
|
83
85
|
number_pressed = true
|
84
|
-
when
|
85
|
-
if respond_to? c
|
86
|
-
public_send c
|
86
|
+
when ?!..?~
|
87
|
+
if respond_to? c
|
88
|
+
public_send c
|
87
89
|
else
|
88
90
|
debug "key: #{c}" if ENV['DEBUG']
|
89
91
|
end
|
@@ -113,7 +115,7 @@ module Rfd
|
|
113
115
|
|
114
116
|
# Change the number of columns in the main window.
|
115
117
|
def spawn_panes(num)
|
116
|
-
main.
|
118
|
+
main.number_of_panes = num
|
117
119
|
@current_row = @current_page = 0
|
118
120
|
end
|
119
121
|
|
@@ -145,15 +147,12 @@ module Rfd
|
|
145
147
|
# The row number can be out of range of the current page.
|
146
148
|
def move_cursor(row = nil)
|
147
149
|
if row
|
148
|
-
|
149
|
-
|
150
|
-
switch_page page
|
151
|
-
else
|
152
|
-
if (prev_item = items[current_row])
|
153
|
-
main.draw_item prev_item
|
154
|
-
end
|
150
|
+
if (prev_item = items[current_row])
|
151
|
+
main.draw_item prev_item
|
155
152
|
end
|
156
|
-
|
153
|
+
page = row / max_items
|
154
|
+
switch_page page if page != current_page
|
155
|
+
main.activate_pane row / maxy
|
157
156
|
@current_row = row
|
158
157
|
else
|
159
158
|
@current_row = 0
|
@@ -161,9 +160,10 @@ module Rfd
|
|
161
160
|
|
162
161
|
item = items[current_row]
|
163
162
|
main.draw_item item, current: true
|
163
|
+
main.display current_page
|
164
164
|
|
165
165
|
header_l.draw_current_file_info item
|
166
|
-
header_l.
|
166
|
+
header_l.refresh
|
167
167
|
@current_row
|
168
168
|
end
|
169
169
|
|
@@ -255,16 +255,16 @@ module Rfd
|
|
255
255
|
unless in_zip?
|
256
256
|
@items = Dir.foreach(current_dir).map {|fn|
|
257
257
|
stat = File.lstat current_dir.join(fn)
|
258
|
-
Item.new dir: current_dir, name: fn, stat: stat, window_width:
|
258
|
+
Item.new dir: current_dir, name: fn, stat: stat, window_width: main.width
|
259
259
|
}.to_a.partition {|i| %w(. ..).include? i.name}.flatten
|
260
260
|
else
|
261
|
-
@items = [Item.new(dir: current_dir, name: '.', stat: File.stat(current_dir), window_width:
|
262
|
-
Item.new(dir: current_dir, name: '..', stat: File.stat(File.dirname(current_dir)), window_width:
|
261
|
+
@items = [Item.new(dir: current_dir, name: '.', stat: File.stat(current_dir), window_width: main.width),
|
262
|
+
Item.new(dir: current_dir, name: '..', stat: File.stat(File.dirname(current_dir)), window_width: main.width)]
|
263
263
|
zf = Zip::File.new current_dir
|
264
264
|
zf.each {|entry|
|
265
265
|
next if entry.name_is_directory?
|
266
266
|
stat = zf.file.stat entry.name
|
267
|
-
@items << Item.new(dir: current_dir, name: entry.name, stat: stat, window_width:
|
267
|
+
@items << Item.new(dir: current_dir, name: entry.name, stat: stat, window_width: main.width)
|
268
268
|
}
|
269
269
|
end
|
270
270
|
end
|
@@ -298,7 +298,9 @@ module Rfd
|
|
298
298
|
|
299
299
|
# Update the main window with the loaded files and directories. Also update the header.
|
300
300
|
def draw_items
|
301
|
-
main.
|
301
|
+
main.newpad items
|
302
|
+
@displayed_items = items[current_page * max_items, max_items]
|
303
|
+
main.display current_page
|
302
304
|
header_l.draw_path_and_page_number path: current_dir.path, current: current_page + 1, total: total_pages
|
303
305
|
end
|
304
306
|
|
@@ -597,8 +599,9 @@ module Rfd
|
|
597
599
|
# ==== Parameters
|
598
600
|
# * +page+ - Target page number
|
599
601
|
def switch_page(page)
|
600
|
-
@current_page = page
|
601
|
-
|
602
|
+
main.display (@current_page = page)
|
603
|
+
@displayed_items = items[current_page * max_items, max_items]
|
604
|
+
header_l.draw_path_and_page_number path: current_dir.path, current: current_page + 1, total: total_pages
|
602
605
|
end
|
603
606
|
|
604
607
|
# Update the header information concerning currently marked files or directories.
|
@@ -633,12 +636,12 @@ module Rfd
|
|
633
636
|
cmd, *args = command_line.get_command(prompt: prompt).split(' ')
|
634
637
|
if cmd && !cmd.empty? && respond_to?(cmd)
|
635
638
|
self.public_send cmd, *args
|
636
|
-
command_line.
|
637
|
-
command_line.
|
639
|
+
command_line.clear
|
640
|
+
command_line.refresh
|
638
641
|
end
|
639
642
|
rescue Interrupt
|
640
|
-
command_line.
|
641
|
-
command_line.
|
643
|
+
command_line.clear
|
644
|
+
command_line.refresh
|
642
645
|
end
|
643
646
|
|
644
647
|
# Accept user input, and directly execute it in an external shell.
|
@@ -650,8 +653,8 @@ module Rfd
|
|
650
653
|
end
|
651
654
|
rescue Interrupt
|
652
655
|
ensure
|
653
|
-
command_line.
|
654
|
-
command_line.
|
656
|
+
command_line.clear
|
657
|
+
command_line.refresh
|
655
658
|
end
|
656
659
|
|
657
660
|
# Let the user answer y or n.
|
@@ -660,12 +663,12 @@ module Rfd
|
|
660
663
|
# * +prompt+ - Prompt message
|
661
664
|
def ask(prompt = '(y/n)')
|
662
665
|
command_line.set_prompt prompt
|
663
|
-
command_line.
|
666
|
+
command_line.refresh
|
664
667
|
while (c = Curses.getch)
|
665
668
|
next unless [?N, ?Y, ?n, ?y, 3, 27] .include? c # N, Y, n, y, ^c, esc
|
666
|
-
command_line.
|
667
|
-
command_line.
|
668
|
-
break
|
669
|
+
command_line.clear
|
670
|
+
command_line.refresh
|
671
|
+
break (c == 'y') || (c == 'Y')
|
669
672
|
end
|
670
673
|
end
|
671
674
|
|
@@ -734,8 +737,8 @@ module Rfd
|
|
734
737
|
Curses.getch if pause
|
735
738
|
#NOTE needs to draw borders and ls again here since the stdlib Curses.refresh fails to retrieve the previous screen
|
736
739
|
Rfd::Window.draw_borders
|
737
|
-
ls
|
738
740
|
Curses.refresh
|
741
|
+
ls
|
739
742
|
end
|
740
743
|
|
741
744
|
def expand_path(path)
|
@@ -756,7 +759,7 @@ module Rfd
|
|
756
759
|
end
|
757
760
|
|
758
761
|
def debug(str)
|
759
|
-
|
762
|
+
@debug.debug str
|
760
763
|
end
|
761
764
|
end
|
762
765
|
end
|
data/lib/rfd/commands.rb
CHANGED
@@ -192,7 +192,7 @@ module Rfd
|
|
192
192
|
draw_items
|
193
193
|
move_cursor current_row
|
194
194
|
draw_marked_items
|
195
|
-
header_r.
|
195
|
+
header_r.refresh
|
196
196
|
end
|
197
197
|
|
198
198
|
# "b"ack to the previous page.
|
@@ -279,7 +279,7 @@ module Rfd
|
|
279
279
|
toggle_mark
|
280
280
|
j
|
281
281
|
draw_marked_items
|
282
|
-
header_r.
|
282
|
+
header_r.refresh
|
283
283
|
end
|
284
284
|
|
285
285
|
# cd to the upper hierarchy.
|
data/lib/rfd/windows.rb
CHANGED
@@ -1,95 +1,35 @@
|
|
1
|
-
|
2
|
-
class Window
|
3
|
-
ACS_URCORNER = 4194411
|
4
|
-
ACS_LRCORNER = 4194410
|
5
|
-
ACS_ULCORNER = 4194412
|
6
|
-
ACS_LLCORNER = 4194413
|
7
|
-
ACS_HLINE = 4194417
|
8
|
-
ACS_LTEE = 4194420
|
9
|
-
ACS_RTEE = 4194421
|
10
|
-
ACS_BTEE = 4194422
|
11
|
-
ACS_TTEE = 4194423
|
12
|
-
ACS_VLINE = 4194424
|
13
|
-
|
14
|
-
attr_reader :window
|
1
|
+
require 'delegate'
|
15
2
|
|
3
|
+
module Rfd
|
4
|
+
class Window < DelegateClass(Curses::Window)
|
16
5
|
def self.draw_borders
|
17
|
-
Curses.
|
18
|
-
Curses.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Curses.addch ACS_URCORNER
|
23
|
-
|
24
|
-
[*1..3, *5..(Curses.lines - 3)].each do |i|
|
25
|
-
Curses.setpos i, 0
|
26
|
-
Curses.addch ACS_VLINE
|
27
|
-
Curses.setpos i, Curses.cols - 1
|
28
|
-
Curses.addch ACS_VLINE
|
29
|
-
end
|
30
|
-
[1, 2, 3].each do |i|
|
31
|
-
Curses.setpos i, Curses.cols - 31
|
32
|
-
Curses.addch ACS_VLINE
|
33
|
-
end
|
34
|
-
|
35
|
-
Curses.setpos 4, 0
|
36
|
-
Curses.addch ACS_LTEE
|
37
|
-
(Curses.cols - 32).times { Curses.addch ACS_HLINE }
|
38
|
-
Curses.addch ACS_BTEE
|
39
|
-
29.times { Curses.addch ACS_HLINE }
|
40
|
-
Curses.addch ACS_RTEE
|
41
|
-
|
42
|
-
Curses.setpos Curses.lines - 2, 0
|
43
|
-
Curses.addch ACS_LLCORNER
|
44
|
-
(Curses.cols - 2).times { Curses.addch ACS_HLINE }
|
45
|
-
Curses.addch ACS_LRCORNER
|
6
|
+
[[5, Curses.stdscr.maxx, 0, 0], [5, Curses.cols - 30, 0, 0], [Curses.stdscr.maxy - 5, Curses.stdscr.maxx, 4, 0]].each do |height, width, top, left|
|
7
|
+
w = Curses.stdscr.subwin height, width, top, left
|
8
|
+
w.bkgdset Curses.color_pair(Curses::COLOR_CYAN)
|
9
|
+
w.box 0, 0
|
10
|
+
w.close
|
46
11
|
end
|
47
12
|
end
|
48
13
|
|
49
|
-
def
|
50
|
-
window.
|
51
|
-
end
|
52
|
-
|
53
|
-
def waddstr(str, clear_to_eol_before_add: false)
|
54
|
-
window.clrtoeol if clear_to_eol_before_add
|
55
|
-
window.addstr str
|
56
|
-
end
|
57
|
-
|
58
|
-
def wclear
|
59
|
-
window.clear
|
60
|
-
end
|
61
|
-
|
62
|
-
def wrefresh
|
63
|
-
window.refresh
|
14
|
+
def initialize(maxy: nil, maxx: nil, begy: nil, begx: nil, window: nil)
|
15
|
+
super window || Curses.stdscr.subwin(maxy, maxx, begy, begx)
|
64
16
|
end
|
65
17
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
def maxy
|
71
|
-
window.maxy
|
72
|
-
end
|
73
|
-
|
74
|
-
def begx
|
75
|
-
window.begx
|
76
|
-
end
|
77
|
-
|
78
|
-
def begy
|
79
|
-
window.begy
|
18
|
+
def writeln(row, str)
|
19
|
+
setpos row, 0
|
20
|
+
clrtoeol
|
21
|
+
self << str
|
80
22
|
end
|
81
23
|
end
|
82
24
|
|
83
25
|
class HeaderLeftWindow < Window
|
84
26
|
def initialize
|
85
|
-
|
27
|
+
super maxy: 3, maxx: Curses.cols - 32, begy: 1, begx: 1
|
86
28
|
end
|
87
29
|
|
88
30
|
def draw_path_and_page_number(path: nil, current: 1, total: nil)
|
89
|
-
|
90
|
-
|
91
|
-
waddstr @path_and_page_number, clear_to_eol_before_add: true
|
92
|
-
wrefresh
|
31
|
+
writeln 0, %Q[Page: #{"#{current}/ #{total}".ljust(11)} Path: #{path}]
|
32
|
+
refresh
|
93
33
|
end
|
94
34
|
|
95
35
|
def draw_current_file_info(current_file)
|
@@ -98,170 +38,128 @@ module Rfd
|
|
98
38
|
end
|
99
39
|
|
100
40
|
def draw_current_filename(current_file_name)
|
101
|
-
|
102
|
-
wmove 1
|
103
|
-
waddstr @current_file_name, clear_to_eol_before_add: true
|
41
|
+
writeln 1, "File: #{current_file_name}"
|
104
42
|
end
|
105
43
|
|
106
44
|
def draw_stat(item)
|
107
|
-
|
108
|
-
wmove 2
|
109
|
-
waddstr @stat, clear_to_eol_before_add: true
|
45
|
+
writeln 2, " #{item.size_or_dir.ljust(13)}#{item.mtime} #{item.mode}"
|
110
46
|
end
|
111
47
|
end
|
112
48
|
|
113
49
|
class HeaderRightWindow < Window
|
114
50
|
def initialize
|
115
|
-
|
51
|
+
super maxy: 2, maxx: 29, begy: 2, begx: Curses.cols - 30
|
116
52
|
end
|
117
53
|
|
118
54
|
def draw_marked_items(count: 0, size: 0)
|
119
|
-
|
120
|
-
waddstr %Q[#{"#{count}Marked".rjust(11)} #{size.to_s.reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.rjust(16)}], clear_to_eol_before_add: true
|
55
|
+
writeln 0, %Q[#{"#{count}Marked".rjust(11)} #{size.to_s.reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.rjust(16)}]
|
121
56
|
end
|
122
57
|
|
123
58
|
def draw_total_items(count: 0, size: 0)
|
124
|
-
|
125
|
-
|
126
|
-
|
59
|
+
writeln 1, %Q[#{"#{count}Files".rjust(10)} #{size.to_s.reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.rjust(17)}]
|
60
|
+
refresh
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class DebugWindow < Window
|
65
|
+
def initialize
|
66
|
+
super maxy: 1, maxx: 29, begy: 1, begx: Curses.cols - 30
|
127
67
|
end
|
128
68
|
|
129
69
|
def debug(s)
|
130
|
-
|
131
|
-
|
132
|
-
waddstr s.to_s
|
133
|
-
wrefresh
|
70
|
+
writeln 0, s.to_s
|
71
|
+
refresh
|
134
72
|
end
|
135
73
|
end
|
136
74
|
|
137
75
|
class MainWindow < Window
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
def initialize(panes)
|
142
|
-
@panes, @current_index = panes, 0
|
143
|
-
end
|
144
|
-
|
145
|
-
def active
|
146
|
-
@panes[@current_index]
|
147
|
-
end
|
76
|
+
attr_reader :current_index, :begy
|
77
|
+
attr_writer :number_of_panes
|
148
78
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
def get_index_by_point(y: nil, x: nil)
|
154
|
-
@panes.each.with_index do |p, i|
|
155
|
-
return i if include_point? pane: p, y: y, x: x
|
156
|
-
end if y && x
|
157
|
-
nil
|
158
|
-
end
|
159
|
-
|
160
|
-
def size
|
161
|
-
@panes.size
|
162
|
-
end
|
163
|
-
|
164
|
-
def close_all
|
165
|
-
@panes.each do |p|
|
166
|
-
p.clear
|
167
|
-
p.close
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
def include_point?(pane: pane, y: nil, x: nil)
|
172
|
-
(y >= pane.begy) && (pane.begy + pane.maxy > y) && (x >= pane.begx) && (pane.begx + pane.maxx > x)
|
173
|
-
end
|
79
|
+
def initialize(dir = '.')
|
80
|
+
@begy, @current_index, @number_of_panes = 5, 0, 2
|
81
|
+
super window: Curses::Pad.new(Curses.lines - 7, Curses.cols - 2)
|
174
82
|
end
|
175
83
|
|
176
|
-
def
|
177
|
-
|
84
|
+
def newpad(items)
|
85
|
+
clear
|
86
|
+
columns = items.size / maxy + 1
|
87
|
+
newx = width * (((columns - 1) / @number_of_panes + 1) * @number_of_panes)
|
88
|
+
resize maxy, newx if newx != maxx
|
89
|
+
|
90
|
+
draw_items_to_each_pane items
|
178
91
|
end
|
179
92
|
|
180
|
-
def
|
181
|
-
|
182
|
-
width = (Curses.cols - 2) / num
|
183
|
-
windows = 0.upto(num - 1).inject([]) {|arr, i| arr << Curses.stdscr.subwin(Curses.lines - 7, width - 1, 5, width * i + 1)}
|
184
|
-
@panes = Panes.new windows
|
185
|
-
activate_pane 0
|
93
|
+
def display(page)
|
94
|
+
refresh 0, (Curses.cols - 2) * page, begy, 1, begy + maxy - 1, Curses.cols - 2
|
186
95
|
end
|
187
96
|
|
188
97
|
def activate_pane(num)
|
189
|
-
@
|
98
|
+
@current_index = num
|
190
99
|
end
|
191
100
|
|
192
101
|
def pane_index_at(y: nil, x: nil)
|
193
|
-
|
102
|
+
(y >= begy) && (begy + maxy > y) && (x / width)
|
194
103
|
end
|
195
104
|
|
196
|
-
def
|
197
|
-
@
|
105
|
+
def width
|
106
|
+
(Curses.cols - 2) / @number_of_panes
|
198
107
|
end
|
199
108
|
|
200
109
|
def max_items
|
201
|
-
maxy * @
|
110
|
+
maxy * @number_of_panes
|
202
111
|
end
|
203
112
|
|
204
113
|
def draw_item(item, current: false)
|
205
|
-
|
206
|
-
|
207
|
-
|
114
|
+
setpos item.index % maxy, width * @current_index
|
115
|
+
attron(Curses.color_pair(item.color) | (current ? Curses::A_UNDERLINE : Curses::A_NORMAL)) do
|
116
|
+
self << item.to_s
|
208
117
|
end
|
209
|
-
wrefresh
|
210
118
|
end
|
211
119
|
|
212
120
|
def draw_items_to_each_pane(items)
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
wmove 0
|
219
|
-
items[maxy * index, maxy * (index + 1)].each do |item|
|
220
|
-
window.attron(Curses.color_pair(item.color) | Curses::A_NORMAL) { waddstr "#{item.to_s}\n" }
|
221
|
-
end if items[maxy * index, maxy * (index + 1)]
|
222
|
-
wrefresh
|
121
|
+
items.each_slice(maxy).each.with_index do |arr, col_index|
|
122
|
+
arr.each.with_index do |item, i|
|
123
|
+
setpos i, width * col_index
|
124
|
+
attron(Curses.color_pair(item.color) | Curses::A_NORMAL) { self << item.to_s }
|
125
|
+
end
|
223
126
|
end
|
224
|
-
activate_pane original_active_pane_index
|
225
127
|
end
|
226
128
|
|
227
129
|
def toggle_mark(item)
|
228
130
|
if item.toggle_mark
|
229
|
-
|
230
|
-
|
131
|
+
setpos item.index % maxy, 0
|
132
|
+
self << item.current_mark
|
231
133
|
end
|
232
134
|
end
|
233
135
|
end
|
234
136
|
|
235
137
|
class CommandLineWindow < Window
|
236
138
|
def initialize
|
237
|
-
|
139
|
+
super maxy: 1, maxx: Curses.cols, begy: Curses.lines - 1, begx: 0
|
238
140
|
end
|
239
141
|
|
240
142
|
def set_prompt(str)
|
241
|
-
|
242
|
-
|
243
|
-
window.clrtoeol
|
244
|
-
waddstr str
|
143
|
+
attron(Curses.color_pair(Curses::COLOR_WHITE) | Curses::A_BOLD) do
|
144
|
+
writeln 0, str
|
245
145
|
end
|
246
146
|
end
|
247
147
|
|
248
148
|
def get_command(prompt: nil)
|
249
149
|
Curses.echo
|
250
150
|
startx = prompt ? prompt.size : 1
|
251
|
-
|
252
|
-
s =
|
151
|
+
setpos 0, startx
|
152
|
+
s = getstr
|
253
153
|
"#{prompt[1..-1] if prompt}#{s.strip}"
|
254
154
|
ensure
|
255
155
|
Curses.noecho
|
256
156
|
end
|
257
157
|
|
258
158
|
def show_error(str)
|
259
|
-
|
260
|
-
|
261
|
-
window.clrtoeol
|
262
|
-
waddstr str
|
159
|
+
attron(Curses.color_pair(Curses::COLOR_RED) | Curses::A_BOLD) do
|
160
|
+
writeln 0, str
|
263
161
|
end
|
264
|
-
|
162
|
+
refresh
|
265
163
|
end
|
266
164
|
end
|
267
165
|
end
|
data/rfd.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rfd"
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.6.0'
|
8
8
|
spec.authors = ["Akira Matsuda"]
|
9
9
|
spec.email = ["ronnie@dio.jp"]
|
10
10
|
spec.description = 'Ruby on Files & Directories'
|
data/spec/controller_spec.rb
CHANGED
@@ -31,8 +31,8 @@ describe Rfd::Controller do
|
|
31
31
|
describe '#spawn_panes' do
|
32
32
|
before { controller.spawn_panes 3 }
|
33
33
|
|
34
|
-
subject { controller.main.instance_variable_get :@
|
35
|
-
it { should
|
34
|
+
subject { controller.main.instance_variable_get :@number_of_panes }
|
35
|
+
it { should == 3 }
|
36
36
|
end
|
37
37
|
|
38
38
|
describe '#current_item' do
|
@@ -89,8 +89,8 @@ describe Rfd::Controller do
|
|
89
89
|
before do
|
90
90
|
controller.move_cursor 5
|
91
91
|
end
|
92
|
-
subject { controller.main.instance_variable_get :@
|
93
|
-
|
92
|
+
subject { controller.main.instance_variable_get :@current_index }
|
93
|
+
it { should == 1 }
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'When moving to the second page' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|