class

Opal::UI::CodeView

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Code and disassembly viewing element with line numbers, syntax highlighting, cursor indicator, and vertical scrolling.

Constructors

new(code : String = "", language : Symbol | String = :plain, start_line : Int32 = 1, highlighted_line : Int32 | Nil = nil, scroll_offset : Int32 = 0, show_line_numbers : Bool = true, gutter_fg : Color | Symbol | String | Nil = nil, cursor_fg : Color | Symbol | String | Nil = nil, cursor_indicator : String | Nil = nil, scrollable : Bool = true, auto_scroll : Bool = false, scroll_speed : Float64 = 1.0)
Source

Class methods

to_string(code : String, language : Symbol | String = :plain, show_line_numbers : Bool = true, start_line : Int32 = 1, width : Int32 | Nil = nil, color : Bool | Nil = nil, theme : Theme | Nil = nil) : String

Class convenience method returning styled code string

Source

Instance methods

auto_scroll=(auto_scroll : Bool)
Source
auto_scroll?
Source
code
Source
code=(code : String)
Source
cursor_fg
Source
cursor_fg=(cursor_fg : Color | Nil)
Source
cursor_indicator
Source
cursor_indicator=(cursor_indicator : String | Nil)
Source
gutter_fg
Source
gutter_fg=(gutter_fg : Color | Nil)
Source
handle_key(event : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
highlighted_line
Source
highlighted_line=(highlighted_line : Int32 | Nil)
Source
language
Source
language=(language : Symbol)
Source
lines
Source
preferred_print_size(available_w : Int32) : Tuple(Int32, Int32)

Preferred size in print mode: full line count

Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
render_print(buffer : Buffer, width : Int32, height : Int32) : Nil

Render hook for print mode: resets scroll offset

Source
scroll_down(count : Int32 = 1) : Nil
Source
scroll_offset
Source
scroll_offset=(scroll_offset : Int32)
Source
scroll_speed
Source
scroll_speed=(scroll_speed : Float64)
Source
scroll_up(count : Int32 = 1) : Nil
Source
scrollable=(scrollable : Bool)
Source
scrollable?
Source
show_line_numbers=(show_line_numbers : Bool)
Source
show_line_numbers?
Source
start_line
Source
start_line=(start_line : Int32)
Source
tick(dt : Float64 = 0.0166) : Nil
Source