Method: Textbringer::Window#shrink_if_larger_than_buffer
- Defined in:
- lib/textbringer/window.rb
#shrink_if_larger_than_buffer ⇒ Object
598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/textbringer/window.rb', line 598 def shrink_if_larger_than_buffer @buffer.save_point do @buffer.end_of_buffer @buffer.skip_re_backward(/\s/) count = beginning_of_line_and_count(Window.lines) + 1 while !@buffer.beginning_of_buffer? @buffer.backward_char count += beginning_of_line_and_count(Window.lines) + 1 end if lines - 1 > count shrink(lines - 1 - count) end end end |