diff options
Diffstat (limited to 'code')
-rw-r--r-- | code/keys.rb | 20 | ||||
-rw-r--r-- | code/search.rb | 5 |
2 files changed, 13 insertions, 12 deletions
diff --git a/code/keys.rb b/code/keys.rb index 4d7aa2f7..3784c7d0 100644 --- a/code/keys.rb +++ b/code/keys.rb @@ -142,7 +142,7 @@ module Fm # end log str if str =~ /^\s?(.*)(<cr>|<esc>)$/ - @buffer = '' + @buffer.clear if $2 == '<cr>' files = selection if files.size == 1 @@ -246,7 +246,7 @@ module Fm when /^cd(.+)$/ str = $1 if str =~ /^\s?(.*)(<cr>|<esc>)$/ - @buffer = '' + @buffer.clear if $2 == '<cr>' remember_dir enter_dir_safely($1) @@ -285,17 +285,17 @@ module Fm str = $1 Option.search_method = :regexp if str =~ /^\s?(.*)(L|;|<cr>|<esc>)$/ - @buffer = '' + @buffer.clear @search_string = $1 unless $1.empty? press('l') if $2 == ';' or $2 == 'L' else test = hints(str) if test == 1 - @buffer = '' + @buffer.clear press('l') ignore_keys_for 0.5 elsif test == 0 - @buffer = '' + @buffer.clear ignore_keys_for 1 end end @@ -303,7 +303,7 @@ module Fm when /^\/(.+)$/ str = $1 if str =~ /^\s?(.*)(L|;|<cr>|<esc>)$/ - @buffer = '' + @buffer.clear Option.search_method = :regexp @search_string = $1 @@ -359,7 +359,7 @@ module Fm when /^!(.+)$/ str = $1 if str =~ /^(\!?)(.*)(<cr>|<esc>)$/ - @buffer = '' + @buffer.clear if $3 == '<cr>' externally do system("bash", "-c", $2) @@ -643,22 +643,20 @@ module Fm if key == '<bs>' if @buffer.empty? @buffer = key - elsif @buffer == 'F' - descend elsif @buffer[-1] == ?> @buffer.slice!(/(<.*)?>$/) else @buffer.slice!(-1) end elsif key == '<c-u>' - @buffer = '' + @buffer.clear else @buffer << key end eval_keybuffer - @buffer = '' unless @buffer == '' or @buffer =~ key_regexp + @buffer.clear unless @buffer.empty? or @buffer =~ key_regexp end ## go down 1 directory diff --git a/code/search.rb b/code/search.rb index 2952f59a..27ea4044 100644 --- a/code/search.rb +++ b/code/search.rb @@ -22,16 +22,19 @@ module Fm FIND_KEY_REGEXP = /f([#{ FIND_PROPERTIES.keys.join("") }])/ def quicksearch(n) - log Option.search_method case Option.search_method when *FIND_PROPERTIES.values quicksearch_by_property(n, Option.search_method) + when :handler quicksearch_by_handler(n) + when :regexp quicksearch_by_regexp(n) + else raise "Wrong search method!" + end rescue lograise end |