533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
|
# File 'lib/textbringer/window.rb', line 533
def split(other_lines = nil)
old_lines = lines
if other_lines
if other_lines < CONFIG[:window_min_height]
raise EditorError, "Window too small"
end
new_lines = lines - other_lines
else
new_lines = (old_lines / 2.0).ceil
end
if new_lines < CONFIG[:window_min_height]
raise EditorError, "Window too small"
end
resize(new_lines, columns)
new_window = Window.new(old_lines - new_lines, columns, y + new_lines, x)
new_window.buffer = buffer
i = @@list.index(self)
@@list.insert(i + 1, new_window)
end
|