Class: Fatty::CursorView

Inherits:
View
  • Object
show all
Defined in:
lib/fatty/view/cursor_view.rb

Instance Attribute Summary

Attributes inherited from View

#id, #z

Instance Method Summary collapse

Methods inherited from View

#initialize, #render

Constructor Details

This class inherits a constructor from Fatty::View

Instance Method Details

#draw(screen:, renderer:, terminal:, session:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fatty/view/cursor_view.rb', line 5

def draw(screen:, renderer:, terminal:, session:)
  # When paging is active, the output pane owns the screen and the shell
  # input cursor should be turned off. This also prevents the underlying
  # ShellSession from overriding the cursor while a modal (e.g. SearchSession)
  # is displayed over the pager/status line.
  if session.respond_to?(:pager_active?) && session.pager_active?
    ::Curses.curs_set(0)
  else
    ::Curses.curs_set(1)
    renderer.restore_cursor(session.field)
  end
end