323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
|
# File 'lib/shikaku.rb', line 323
def self.new_buffer app, *options
fname = options.detect { |opt| opt.is_a? String }
no_blank_line = options.include? :no_blank_line
fake_buffer = options.include? :fake_buffer
needs_bnum = options.include? :need_bnum
delay_edlog_load = options.include? :delay_edlog_load
bnum = needs_bnum ? alloc_new_buffer : nil
buf = DocumentBuffer.new app
app.buffers << buf
buf.lines << BufferLine.new("") unless no_blank_line
buf.fake_buffer = true if fake_buffer
app.new_status_bar buf if needs_bnum
fail "are you sure you want to have #{buf.fname} set and delay_edlog_load == #{delay_edlog_load}" \
if !buf.fname.nil? and delay_edlog_load
buf.dlog.load_or_create_difflog unless delay_edlog_load
buf.fname = fname unless fname.nil?
buf.bnum = bnum
buf
end
|