lib/ver/methods/open.rb in ver-2010.02 vs lib/ver/methods/open.rb in ver-2010.08
- old
+ new
@@ -49,11 +49,11 @@
head_index = head.rindex(delim)
return unless tail_index && head_index
base = [head[(head_index + 1)..-1], tail[0...tail_index]].join
- syntax_name = text.syntax.name if @syntax
+ syntax_name = text.syntax.name if text.syntax
exts = VER::Syntax::Detector::EXTS_LIST.fetch(syntax_name, [])
found = catch(:found){
paths.map{|path|
path_base = File.join(path, base)
@@ -113,14 +113,14 @@
text.clear
content = read_file(text, text.filename)
text.encoding = content.encoding
text.readonly = !text.filename.writable?
text.insert(1.0, content)
- VER.message "Opened #{text.short_filename}"
+ text.message "Opened #{text.short_filename}"
rescue Errno::ENOENT
text.clear
- VER.message("Created #{text.short_filename}")
+ text.message("Created #{text.short_filename}")
end
after_open(text, line, column)
end
@@ -146,11 +146,11 @@
after_open(text, 1, 0, Syntax.new('Plain Text'))
else
after_open(text, 1, 0, Syntax.new('Plain Text'))
end
- VER.message "Created #{name}"
+ text.message "Created #{name}"
end
def open_empty(text)
text.clear
text.message "[No File]"
@@ -169,16 +169,17 @@
VER.find_or_create_buffer(fpath)
end
def file_open_ask(text)
- text.ask 'Filename: ', value: Dir.pwd do |answer, action|
+ path = Dir.pwd + '/'
+ text.ask 'Filename: ', value: path do |answer, action|
case action
when :complete
file_complete(answer)
when :attempt
- p answer
+ VER.find_or_create_buffer(answer)
:abort
end
end
end
@@ -330,10 +331,10 @@
when /(?:sw|shiftwidth)=(\d+)/
set text, :shiftwidth, $1.to_i
when /(?:ft|filetype)=(\w+)/
set text, :filetype, $1
else
- p unknown_modeline_option: option
+ l unknown_modeline_option: option
end
end
def set(text, option, value)
method = "set_#{option}"