Class: LLM::Repl::Window Private
- Inherits:
-
Object
- Object
- LLM::Repl::Window
- Defined in:
- lib/llm/repl/window.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The LLM::Repl::Window class draws the curses screen for the REPL.
Instance Attribute Summary collapse
- #input ⇒ LLM::Repl::Input readonly private
- #status ⇒ LLM::Repl::Status readonly private
- #transcript ⇒ LLM::Repl::Transcript readonly private
Instance Method Summary collapse
- #getch ⇒ Object private
- #initialize(status, transcript, input) ⇒ LLM::Repl::Window constructor private
- #open { ... } ⇒ void private
- #redraw ⇒ void private
- #rows ⇒ Integer private
- #scroll_down ⇒ void private
- #scroll_up ⇒ void private
Constructor Details
#initialize(status, transcript, input) ⇒ LLM::Repl::Window
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 |
# File 'lib/llm/repl/window.rb', line 26 def initialize(status, transcript, input) @status = status @transcript = transcript @input = input end |
Instance Attribute Details
#input ⇒ LLM::Repl::Input (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/llm/repl/window.rb', line 19 def input @input end |
#status ⇒ LLM::Repl::Status (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/llm/repl/window.rb', line 11 def status @status end |
#transcript ⇒ LLM::Repl::Transcript (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/llm/repl/window.rb', line 15 def transcript @transcript end |
Instance Method Details
#getch ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/llm/repl/window.rb', line 63 def getch Curses.getch end |
#open { ... } ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
35 36 37 38 39 40 41 42 43 |
# File 'lib/llm/repl/window.rb', line 35 def open Curses.init_screen Curses.cbreak Curses.noecho Curses.stdscr.keypad(true) yield ensure Curses.close_screen end |
#redraw ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
47 48 49 50 51 52 53 |
# File 'lib/llm/repl/window.rb', line 47 def redraw Curses.clear draw_status draw_transcript draw_input Curses.refresh end |
#rows ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 |
# File 'lib/llm/repl/window.rb', line 57 def rows [Curses.lines - 3, 1].max end |
#scroll_down ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
75 76 77 |
# File 'lib/llm/repl/window.rb', line 75 def scroll_down transcript.scroll_down end |
#scroll_up ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
69 70 71 |
# File 'lib/llm/repl/window.rb', line 69 def scroll_up transcript.scroll_up(rows) end |