@textfields = {}
@flash = nil
@shelled = @asking = false
+ @in_x = ENV["TERM"] =~ /(xterm|rxvt|screen)/
self.class.i_am_the_instance self
end
get_status_and_title @focus_buf # must be called outside of the ncurses lock
end
- print "\033]2;#{title}\07" if title
+ print "\033]2;#{title}\07" if title && @in_x
Ncurses.mutex.lock unless opts[:sync] == false
def ask_with_completions domain, question, completions, default=nil
ask domain, question, default do |s|
- completions.select { |x| x =~ /^#{s}/i }.map { |x| [x, x] }
+ completions.select { |x| x =~ /^#{Regexp::escape s}/i }.map { |x| [x, x] }
end
end
raise "william screwed up completion: #{partial.inspect}"
end
- completions.select { |x| x =~ /^#{target}/i }.map { |x| [prefix + x, x] }
+ completions.select { |x| x =~ /^#{Regexp::escape target}/i }.map { |x| [prefix + x, x] }
end
end
prefix, target = partial.split_on_commas_with_remainder
target ||= prefix.pop || ""
prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
- completions.select { |x| x =~ /^#{target}/i }.map { |x| [prefix + x, x] }
+ completions.select { |x| x =~ /^#{Regexp::escape target}/i }.map { |x| [prefix + x, x] }
end
end
if dir
[[s.sub(full, dir), "~#{name}"]]
else
- users.select { |u| u =~ /^#{name}/ }.map do |u|
+ users.select { |u| u =~ /^#{Regexp::escape name}/ }.map do |u|
[s.sub("~#{name}", "~#{u}"), "~#{u}"]
end
end
elsif File.directory?(answer)
spawn_modal "file browser", FileBrowserMode.new(answer)
else
- answer
+ File.expand_path answer
end
end
def ask_getch question, accept=nil
raise "impossible!" if @asking
- @asking = true
accept = accept.split(//).map { |x| x[0] } if accept
Ncurses.refresh
end
+ @asking = true
ret = nil
done = false
until done