From 2cf9236d6a2a53de175338071f784db39b261b9e Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Jun 2009 00:12:45 +0200 Subject: fixed. --- code/fm.rb | 41 ++++++++++++++++++++++++++--------------- interface/ncurses.rb | 4 ++-- minimal.rb | 10 ++++++++++ ranger.rb | 2 +- 4 files changed, 39 insertions(+), 18 deletions(-) create mode 100755 minimal.rb 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 -- cgit 1.4.1-2-gfad0