Method: Textbringer::Window#recenter
- Defined in:
- lib/textbringer/window.rb
#recenter ⇒ Object
503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'lib/textbringer/window.rb', line 503 def recenter @buffer.save_point do |saved| max = (lines - 1) / 2 count = beginning_of_line_and_count(max) while count < max break if @buffer.point == 0 @buffer.backward_char count += beginning_of_line_and_count(max - count - 1) + 1 end @buffer.mark_to_point(@top_of_window) end end |