about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-06-11 00:12:45 +0200
committerhut <hut@lavabit.com>2009-06-11 14:51:38 +0200
commit2cf9236d6a2a53de175338071f784db39b261b9e (patch)
treee71766cd1c5bb29bc51678ef411d35f49a728cea
parentd73f76fc9ed1bf9eeb0ace66d80e7abd55663e3a (diff)
downloadranger-2cf9236d6a2a53de175338071f784db39b261b9e.tar.gz
fixed.
-rw-r--r--code/fm.rb41
-rw-r--r--interface/ncurses.rb4
-rwxr-xr-xminimal.rb10
-rwxr-xr-xranger.rb2
4 files changed, 39 insertions, 18 deletions
diff --git a/code/fm.rb b/code/fm.rb
index 85e60489..3b5ff852 100644
--- a/code/fm.rb
+++ b/code/fm.rb
@@ -7,6 +7,17 @@ OPTIONS = {
 	'filepreview' => true,
 }
 
+class Void
+	oldv, $-v = $-v, nil
+
+	for method in instance_methods
+		remove_method(method) rescue nil
+	end
+
+	def self.method_missing(*a) end
+
+	$-v = oldv
+end
 
 module Fm
 	SCHEDULER_PRIORITY = -1
@@ -40,7 +51,7 @@ module Fm
 		# Read the .fmrc
 		@fmrc = File.expand_path('~/.fmrc')
 		if (File.exists?(@fmrc))
-			loaded = Marshal.load(File.read(@fmrc))
+			loaded = Marshal.load(File.read(@fmrc)) rescue nil
 			if Hash === loaded
 				@memory.update(loaded)
 			end
@@ -73,23 +84,23 @@ module Fm
 		pwd ||= @pwd.path || Dir.getwd
 		# This thread inspects directories
 		@scheduler_active = false
-		if defined? @scheduler and Thread === @scheduler
-			@scheduler.kill
+		if defined? @mcheduler and Thread === @mcheduler
+			@mcheduler.kill
 		end
-		@scheduler = Thread.new do
+		@mcheduler = Thread.new do
 			while true
-				Thread.stop
+#				Thread.stop
+				sleep 0.1
 				if @scheduler_active and !SCHEDULED.empty?
-#					@mutex.synchronize {
-						while dir = SCHEDULED.shift
-							dir.refresh(true)
-							dir.resize
-							force_update
-						end
-#					}
+					while dir = SCHEDULED.shift
+						dir.refresh(true)
+						dir.resize
+						force_update
+					end
 				end
 			end
 		end
+		@scheduler = Void
 		@scheduler.priority = SCHEDULER_PRIORITY
 
 
@@ -142,9 +153,9 @@ module Fm
 				draw()
 			rescue Interrupt
 				on_interrupt
-			rescue Exception
-				log($!)
-				log(caller)
+#			rescue Exception
+#				log($!)
+#				log(caller)
 			end
 
 			begin
diff --git a/interface/ncurses.rb b/interface/ncurses.rb
index 86d4063d..3736f60c 100644
--- a/interface/ncurses.rb
+++ b/interface/ncurses.rb
@@ -51,7 +51,7 @@ module Interface
 
 		Ncurses.noecho
 		Ncurses.curs_set 0
-		Ncurses.halfdelay(0)
+		Ncurses.halfdelay(200)
 		@@colortable = []
 	end
 
@@ -59,7 +59,7 @@ module Interface
 	def closei
 		@@running = false
 		Ncurses.echo
-		Ncurses.cbreak
+		Ncurses.nocbreak
 		Ncurses.curs_set 1
 		Ncurses.endwin
 	end
diff --git a/minimal.rb b/minimal.rb
new file mode 100755
index 00000000..ee1d11ad
--- /dev/null
+++ b/minimal.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/ruby
+require 'thread'
+require 'ncurses'
+
+Ncurses.initscr
+Ncurses.cbreak
+
+Thread.new { Thread.stop }
+loop { Ncurses.getch }
+
diff --git a/ranger.rb b/ranger.rb
index a3d893fb..bce41689 100755
--- a/ranger.rb
+++ b/ranger.rb
@@ -75,7 +75,7 @@ ensure
 	log "exiting!"
 	log ""
 	closei if Interface.running?
-	Fm.dump
+#	Fm.dump
 	ERROR_STREAM.close
 
 	# Kill all other threads