summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-06-12 01:02:20 +0200
committerhut <hut@lavabit.com>2009-06-12 01:02:20 +0200
commit00ec77361efe9bf14042080bd6a16a4efaec831c (patch)
tree58c9bf9c2bfd20967042e641fb9e210d3d2f2b53 /code
parent1ec7a5eeb823d36a2fbccb2f51c6ec9a157adb35 (diff)
downloadranger-00ec77361efe9bf14042080bd6a16a4efaec831c.tar.gz
moved fm class to code/fm/
Diffstat (limited to 'code')
-rw-r--r--code/fm/fm.rb (renamed from code/fm.rb)48
-rw-r--r--code/fm/keys.rb (renamed from code/keys.rb)0
-rw-r--r--code/fm/types.rb (renamed from code/types.rb)0
3 files changed, 26 insertions, 22 deletions
diff --git a/code/fm.rb b/code/fm/fm.rb
index 77dd327c..81b868ca 100644
--- a/code/fm.rb
+++ b/code/fm/fm.rb
@@ -20,18 +20,18 @@ class Void
 end
 
 module Fm
+	extend self
 	COPY_PRIORITY = -2
 
 	COLUMNS = 4
 	VI = "vi -c 'map h :quit<CR>' -c 'map q :quit<CR>'" <<
 		" -c 'map H :unmap h<CR>:unmap H<CR>' %s"
-
+	
 	def self.initialize(pwd=nil)
 		@bars = []
 		@bars_thread = nil
 		
 		@buffer = ''
-#		@mutex = Mutex.new
 		@pwd = nil
 		@search_string = ''
 		@copy = []
@@ -59,10 +59,6 @@ module Fm
 
 		# Give me some way to redraw screen while waiting for
 		# input from Interface.geti
-		Signal.trap(Scheduler::UPDATE_SIGNAL) do
-			@pwd.refresh
-			draw
-		end
 
 #		for i in 1..20
 #			eval "Signal.trap(#{i}) do
@@ -75,9 +71,17 @@ module Fm
 
 	attr_reader(:dirs, :pwd)
 
-	def self.pwd() @pwd end
+	def pwd() @pwd end
+
+	def refresh()
+		begin
+			@pwd.refresh
+			draw
+		rescue
+		end
+	end
 
-	def self.boot_up(pwd=nil)
+	def boot_up(pwd=nil)
 		pwd ||= @pwd.path || Dir.getwd
 		Scheduler.reset
 
@@ -93,11 +97,11 @@ module Fm
 		Scheduler.run
 	end
 
-	def self.lines
+	def lines
 		Interface::lines - @bars.size
 	end
 
-	def self.dump
+	def dump
 		remember_dir
 		dumped = Marshal.dump(@memory)
 		File.open(@fmrc, 'w') do |f|
@@ -105,12 +109,12 @@ module Fm
 		end
 	end
 
-	def self.on_interrupt
+	def on_interrupt
 		@buffer = ''
 		sleep 0.2
 	end
 
-	def self.main_loop
+	def main_loop
 		bool = false
 		while true
 			if @pwd.size == 0 or @pwd.pos < 0
@@ -146,11 +150,11 @@ module Fm
 		end
 	end
 
-	def self.current_path() @pwd.path end
+	def current_path() @pwd.path end
 
-	def self.reset_title() set_title("fm: #{@pwd.path}") end
+	def reset_title() set_title("fm: #{@pwd.path}") end
 
-	def self.enter_dir_safely(dir)
+	def enter_dir_safely(dir)
 		dir = File.expand_path(dir)
 		if File.exists?(dir) and File.directory?(dir)
 			olddir = @pwd.path
@@ -167,7 +171,7 @@ module Fm
 		end
 	end
 
-	def self.enter_dir(dir)
+	def enter_dir(dir)
 		@pwd.restore if @pwd
 		@marked = []
 		dir = File.expand_path(dir)
@@ -212,8 +216,8 @@ module Fm
 		Dir.chdir(@pwd.path)
 	end
 
-	def self.currentfile() @pwd.files[@pwd.pos] end
-	def self.selection()
+	def currentfile() @pwd.files[@pwd.pos] end
+	def selection()
 		if @marked.empty?
 			[currentfile]
 		else
@@ -221,7 +225,7 @@ module Fm
 		end
 	end
 
-	def self.move_to_trash!(fn)
+	def move_to_trash!(fn)
 		unless File.exists?(@trash)
 			Dir.mkdir(@trash)
 		end
@@ -232,7 +236,7 @@ module Fm
 		return new_path
 	end
 
-	def self.move_to_trash(file)
+	def move_to_trash(file)
 		unless file
 			return
 		end
@@ -261,7 +265,7 @@ module Fm
 		return nil
 	end
 
-	def self.bar_add(bar)
+	def bar_add(bar)
 		if @bars.empty?
 			# This thread updates the statusbars
 			@bars_thread = Thread.new do
@@ -274,7 +278,7 @@ module Fm
 		@bars << bar
 	end
 
-	def self.bar_del(bar)
+	def bar_del(bar)
 		@bars.delete(bar)
 		if @bars.empty?
 			@bars_thread.kill
diff --git a/code/keys.rb b/code/fm/keys.rb
index bca4f4cd..bca4f4cd 100644
--- a/code/keys.rb
+++ b/code/fm/keys.rb
diff --git a/code/types.rb b/code/fm/types.rb
index 2c21c214..2c21c214 100644
--- a/code/types.rb
+++ b/code/fm/types.rb
64' href='#n364'>364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537