rfd 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69382b24587d8b96f6e478174154cec5789aee94
4
- data.tar.gz: 0358469e32e915327f17bcd8f5ea379449ffc3c9
3
+ metadata.gz: 85ce1000330ce786e4ea5b2dba2854adb3188a89
4
+ data.tar.gz: 47299a571cdf2f7e18fea161971b463c1a5ea733
5
5
  SHA512:
6
- metadata.gz: 977b478de382705aaced23f74ae8714f796d3d8d1e92a073c0dcb6e5fda07b9b3ff33f375598143d5fb433e6f2a151bcfbc86cee97cd5f56f24295de0e207d24
7
- data.tar.gz: f70b35ab1d5a592c13d3540f2b4dd92cc3cac1c56415b6a64d8fcedf6903212b4dc7c41d657fc64921534120b058548e040af2069022cc89752a31ac752ca0b3
6
+ metadata.gz: 4fbdea0a3e8ba2c97369f5e9d057fe18d3bc3214c01f868c6212196e7d5fdaeecd17a194225d751880b45052aed7055f7ac448e80c961fece3c8538355502346
7
+ data.tar.gz: e640102c242bd0741ebaafae583c6b5ac166b2038785021b800da907fcc061b01756687ba5c617020cba9bc5acfa62a0f557afb1482695ba3ad00ff047737f9f
data/lib/rfd.rb CHANGED
@@ -34,9 +34,10 @@ module Rfd
34
34
  def self.start(dir = '.')
35
35
  init_curses
36
36
  Rfd::Window.draw_borders
37
- Curses.refresh
37
+ Curses.stdscr.noutrefresh
38
38
  rfd = Rfd::Controller.new
39
39
  rfd.cd dir
40
+ Curses.doupdate
40
41
  rfd
41
42
  end
42
43
 
@@ -60,7 +61,7 @@ module Rfd
60
61
  loop do
61
62
  begin
62
63
  number_pressed = false
63
- case (c = Curses.getch)
64
+ ret = case (c = Curses.getch)
64
65
  when 10, 13 # enter, return
65
66
  enter
66
67
  when 27 # ESC
@@ -101,6 +102,7 @@ module Rfd
101
102
  else
102
103
  debug "key: #{c}" if ENV['DEBUG']
103
104
  end
105
+ Curses.doupdate if ret
104
106
  @times = nil unless number_pressed
105
107
  rescue StopIteration
106
108
  raise
@@ -163,7 +165,6 @@ module Rfd
163
165
  main.display current_page
164
166
 
165
167
  header_l.draw_current_file_info item
166
- header_l.refresh
167
168
  @current_row
168
169
  end
169
170
 
@@ -180,6 +181,7 @@ module Rfd
180
181
  @current_dir, @current_page, @current_row = dir, 0, nil
181
182
  main.activate_pane 0
182
183
  ls
184
+ @current_dir
183
185
  end
184
186
 
185
187
  # cd to the previous directory.
@@ -199,6 +201,7 @@ module Rfd
199
201
 
200
202
  draw_marked_items
201
203
  draw_total_items
204
+ true
202
205
  end
203
206
 
204
207
  # Sort the whole files and directories in the current directory, then refresh the screen.
@@ -586,7 +589,7 @@ module Rfd
586
589
 
587
590
  # Number of pages in the current directory.
588
591
  def total_pages
589
- items.size / max_items + 1
592
+ (items.size - 1) / max_items + 1
590
593
  end
591
594
 
592
595
  # Move to the given page number.
@@ -630,13 +633,14 @@ module Rfd
630
633
  command_line.set_prompt prompt
631
634
  cmd, *args = command_line.get_command(prompt: prompt).split(' ')
632
635
  if cmd && !cmd.empty? && respond_to?(cmd)
633
- self.public_send cmd, *args
636
+ ret = self.public_send cmd, *args
634
637
  command_line.clear
635
- command_line.refresh
638
+ command_line.noutrefresh
639
+ ret
636
640
  end
637
641
  rescue Interrupt
638
642
  command_line.clear
639
- command_line.refresh
643
+ command_line.noutrefresh
640
644
  end
641
645
 
642
646
  # Accept user input, and directly execute it in an external shell.
@@ -649,7 +653,7 @@ module Rfd
649
653
  rescue Interrupt
650
654
  ensure
651
655
  command_line.clear
652
- command_line.refresh
656
+ command_line.noutrefresh
653
657
  end
654
658
 
655
659
  # Let the user answer y or n.
@@ -662,7 +666,7 @@ module Rfd
662
666
  while (c = Curses.getch)
663
667
  next unless [?N, ?Y, ?n, ?y, 3, 27] .include? c # N, Y, n, y, ^c, esc
664
668
  command_line.clear
665
- command_line.refresh
669
+ command_line.noutrefresh
666
670
  break (c == 'y') || (c == 'Y')
667
671
  end
668
672
  end
@@ -192,7 +192,6 @@ module Rfd
192
192
  draw_items
193
193
  move_cursor current_row
194
194
  draw_marked_items
195
- header_r.refresh
196
195
  end
197
196
 
198
197
  # "b"ack to the previous page.
@@ -246,17 +245,17 @@ module Rfd
246
245
  end
247
246
 
248
247
  # Change current directory (cd).
249
- define_method('@') do
248
+ define_method(:'@') do
250
249
  process_command_line preset_command: 'cd'
251
250
  end
252
251
 
253
252
  # Execute a shell command in an external shell.
254
- define_method('!') do
253
+ define_method(:!) do
255
254
  process_shell_command
256
255
  end
257
256
 
258
257
  # Execute a command in the controller context.
259
- define_method(':') do
258
+ define_method(:':') do
260
259
  process_command_line
261
260
  end
262
261
 
@@ -277,9 +276,8 @@ module Rfd
277
276
  # Toggle mark, and move down.
278
277
  def space
279
278
  toggle_mark
280
- j
281
279
  draw_marked_items
282
- header_r.refresh
280
+ j
283
281
  end
284
282
 
285
283
  # cd to the upper hierarchy.
@@ -29,14 +29,16 @@ module Rfd
29
29
 
30
30
  def draw_path_and_page_number(path: nil, current: 1, total: nil)
31
31
  writeln 0, %Q[Page: #{"#{current}/ #{total}".ljust(11)} Path: #{path}]
32
- refresh
32
+ noutrefresh
33
33
  end
34
34
 
35
35
  def draw_current_file_info(current_file)
36
36
  draw_current_filename current_file.full_display_name
37
37
  draw_stat current_file
38
+ noutrefresh
38
39
  end
39
40
 
41
+ private
40
42
  def draw_current_filename(current_file_name)
41
43
  writeln 1, "File: #{current_file_name}"
42
44
  end
@@ -53,11 +55,12 @@ module Rfd
53
55
 
54
56
  def draw_marked_items(count: 0, size: 0)
55
57
  writeln 0, %Q[#{"#{count}Marked".rjust(11)} #{size.to_s.reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.rjust(16)}]
58
+ noutrefresh
56
59
  end
57
60
 
58
61
  def draw_total_items(count: 0, size: 0)
59
62
  writeln 1, %Q[#{"#{count}Files".rjust(10)} #{size.to_s.reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.rjust(17)}]
60
- refresh
63
+ noutrefresh
61
64
  end
62
65
  end
63
66
 
@@ -68,7 +71,7 @@ module Rfd
68
71
 
69
72
  def debug(s)
70
73
  writeln 0, s.to_s
71
- refresh
74
+ noutrefresh
72
75
  end
73
76
  end
74
77
 
@@ -91,7 +94,7 @@ module Rfd
91
94
  end
92
95
 
93
96
  def display(page)
94
- refresh 0, (Curses.cols - 2) * page, begy, 1, begy + maxy - 1, Curses.cols - 2
97
+ noutrefresh 0, (Curses.cols - 2) * page, begy, 1, begy + maxy - 1, Curses.cols - 2
95
98
  end
96
99
 
97
100
  def activate_pane(num)
@@ -156,7 +159,7 @@ module Rfd
156
159
  attron(Curses.color_pair(Curses::COLOR_RED) | Curses::A_BOLD) do
157
160
  writeln 0, str
158
161
  end
159
- refresh
162
+ noutrefresh
160
163
  end
161
164
  end
162
165
  end
@@ -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.6.1'
7
+ spec.version = '0.6.2'
8
8
  spec.authors = ["Akira Matsuda"]
9
9
  spec.email = ["ronnie@dio.jp"]
10
10
  spec.description = 'Ruby on Files & Directories'
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.6.1
4
+ version: 0.6.2
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-23 00:00:00.000000000 Z
11
+ date: 2013-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip