about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/directory.rb36
-rw-r--r--code/draw.rb2
-rw-r--r--code/fm.rb8
-rw-r--r--code/keys.rb4
4 files changed, 5 insertions, 45 deletions
diff --git a/code/directory.rb b/code/directory.rb
index ab636b0b..8e8f2269 100644
--- a/code/directory.rb
+++ b/code/directory.rb
@@ -62,30 +62,12 @@ class Directory
 	def read?() @read end
 
 	def pos=(x)
-#		if @files.size <= 1 or x < 0
-#			x = 0
-#		elsif x > @files.size
-#			x = @files.size - 1
-#		end
 		@pos = x
 		make_sure_cursor_is_in_range()
 		@pointed_file = @files_raw[x]
 		resize
 	end
 
-	def recheck_stuff()
-#		log "pointed file: #@pointed_file"
-#		log @files_raw
-#		log ""
-		if test = @files_raw.index(@pointed_file)
-#			log("if")
-			@pos = test
-		else
-#			log("else")
-			make_sure_cursor_is_in_range()
-		end
-	end
-
 	def make_sure_cursor_is_in_range()
 		if @files.size <= 1 or @pos < 0
 			@pos = 0
@@ -163,24 +145,6 @@ class Directory
 		schedule_resort
 	end
 
-#	def refresh()
-#		@files = Dir.new(@path).to_a
-#		if Option.hidden
-#			@files -= ['.', '..', 'lost+found']
-#		else
-#			@files.reject!{|x| x[0] == ?. or x == 'lost+found'}
-#		end
-#		if @files.empty?
-#			@files = ['.']
-#		end
-#		@files.map!{|basename| Entry.new(@path, basename)}
-#
-#		if @pos >= @files.size
-#			@pos = @files.size - 1
-#		elsif @files.include?(@pointed_file)
-#			@pos = @files.index(@pointed_file)
-#		end
-#	end
 	def refresh(info=false)
 		oldfile = @pointed_file
 
diff --git a/code/draw.rb b/code/draw.rb
index 3144316a..39f815fa 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -222,7 +222,7 @@ module Fm
 				puti i+=1, 2, "#{key} => #{val}"
 			end
 		else
-			@pwd.recheck_stuff()
+			@pwd.make_sure_cursor_is_in_range
 			cf = currentfile
 
 			if cf and s0 = cf.mimetype
diff --git a/code/fm.rb b/code/fm.rb
index 4f1a5742..793c118a 100644
--- a/code/fm.rb
+++ b/code/fm.rb
@@ -50,7 +50,7 @@ module Fm
 
 	def refresh()
 		begin
-			@pwd.refresh!
+			@pwd.refresh
 			update_pointers
 			draw if CLI.running?
 		rescue
@@ -138,11 +138,7 @@ module Fm
 		bool = false
 		while true
 			exit if terminal_killed?
-			if @pwd.size == 0 or @pwd.pos < 0
-				@pwd.pos = 0
-			elsif @pwd.pos >= @pwd.size - 1
-				@pwd.pos = @pwd.size - 1
-			end
+			@pwd.make_sure_cursor_is_in_range
 
 			begin
 				draw()
diff --git a/code/keys.rb b/code/keys.rb
index ac0bce39..6abcfcd4 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -403,7 +403,7 @@ module Fm
 			Fm.boot_up
 
 		when 'v'
-			@marked = []
+			@marked.clear
 			for file in @pwd.files
 				if file.marked
 					file.marked = false
@@ -417,7 +417,7 @@ module Fm
 			for file in @marked
 				file.marked = false
 			end
-			@marked = []
+			@marked.clear
 
 		when /^F(.+)$/
 			str = $1