about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--code/directory.rb4
-rw-r--r--code/draw.rb2
-rw-r--r--code/extensions/basic.rb8
-rw-r--r--code/keys.rb4
-rw-r--r--code/scheduler.rb41
-rw-r--r--code/types.rb4
-rwxr-xr-xranger.rb4
7 files changed, 38 insertions, 29 deletions
diff --git a/code/directory.rb b/code/directory.rb
index 0b1e4e60..d3c4382b 100644
--- a/code/directory.rb
+++ b/code/directory.rb
@@ -34,10 +34,10 @@ class Directory
 			@marked = false
 		end
 
-		attr_reader *%w(
+		attr_reader(*%w{
 			basename mtime rights type path ext
 			infostring readlink basename size ctime name
-		)
+		})
 
 		attr_accessor(:marked)
 		
diff --git a/code/draw.rb b/code/draw.rb
index 175a9a1a..8e032199 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -284,7 +284,7 @@ module Fm
 			end
 
 			bold false
-			color -1, -1
+			color(-1, -1)
 			btm = lines - 1
 
 			case @buffer
diff --git a/code/extensions/basic.rb b/code/extensions/basic.rb
index c822e9f6..520dac42 100644
--- a/code/extensions/basic.rb
+++ b/code/extensions/basic.rb
@@ -72,7 +72,7 @@ class Numeric
 		self < min ? min : (self > max ? max : self)
 	end
 
-	def bytes space = true, n_round = 2
+	def bytes(space = true, n_round = 2)
 		n = 1024
 		a = %w(B K M G T Y)
 
@@ -135,9 +135,9 @@ class File
 		end
 
 		s = ("%o" % File.stat(f).mode)[-3..-1]
-		for m in s.each_char
-			result << MODES_HASH[m]
-		end
+#		s.each_char do |m|
+#			result << MODES_HASH[m]
+#		end
 
 		result
 	end
diff --git a/code/keys.rb b/code/keys.rb
index f3fcdbee..bca4f4cd 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -108,9 +108,9 @@ module Fm
 			elsif @buffer == 'F'
 				descend
 			elsif @buffer[-1] == ?>
-				@buffer.slice! /(<.*)?>$/
+				@buffer.slice!(/(<.*)?>$/)
 			else
-				@buffer.slice! -1
+				@buffer.slice!(-1)
 			end
 		elsif key == '<c-u>'
 			@buffer = ''
diff --git a/code/scheduler.rb b/code/scheduler.rb
index 3644f681..9b716d2f 100644
--- a/code/scheduler.rb
+++ b/code/scheduler.rb
@@ -12,22 +12,24 @@ module Scheduler
 		@active = false
 
 		@thread ||= Thread.new do
-#			Thread.current.priority = PRIORITY
-			while true
-				sleep 0.1
-				if @active and not @scheduled.empty?
-					while dir = @scheduled.shift
-						dir.refresh(true)
-						dir.resize
-						force_update
-					end
+			if EVIL
+				Thread.current.priority = PRIORITY
+				while true
+					Thread.stop
+					manage unless @scheduled.empty? or !@active
+				end
+
+			else
+				while true
+					sleep 0.1
+					manage unless @scheduled.empty? or !@active
 				end
 			end
 		end
 	end
 
 	def run
-		@active = true
+#		@active = true
 	end
 
 	def stop
@@ -36,20 +38,25 @@ module Scheduler
 
 	def <<(dir)
 		dir.scheduled = true
-		unless include? dir
+		unless @scheduled.include? dir
 			@scheduled << dir
+			if EVIL
+				@thread.run
+			end
 		end
 	end
 
-	def include?(dir)
-		@scheduled.include?(dir)
+	private
+	def manage
+		while dir = @scheduled.shift
+			dir.refresh(true)
+			dir.resize
+			force_update
+		end
 	end
 
 	def force_update
 		Process.kill( UPDATE_SIGNAL, PID )
 	end
-
-#	def priority() @thread.priority end
-#	def priority=(x) @thread.priority=(x) end
-
 end
+
diff --git a/code/types.rb b/code/types.rb
index 6d3999c7..2c21c214 100644
--- a/code/types.rb
+++ b/code/types.rb
@@ -75,9 +75,9 @@ module Fm
 			end
 		end
 
-		module_function *%w*
+		module_function(*%w{
 			mplayer zsnes evince image
-		*
+		})
 	end
 
 	def self.getfilehandler_frompath(*files)
diff --git a/ranger.rb b/ranger.rb
index 25b48920..7409060d 100755
--- a/ranger.rb
+++ b/ranger.rb
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby -Ku
+#!/usr/bin/ruby -Kudw
 version = '0.2.2'
 
 # Log details
@@ -18,6 +18,8 @@ $: << MYDIR = File.dirname(Pathname.new(__FILE__).realpath)
 
 #SCREENSAVER = fj MYDIR, 'code', 'screensaver', 'clock.rb'
 
+EVIL = false
+
 PID = Process.pid
 
 if ARGV.size > 0