Class: Twterm::Screen
Instance Method Summary
collapse
Methods included from Subscriber
included, #subscribe, #unsubscribe
Constructor Details
#initialize(app, client) ⇒ Screen
Returns a new instance of Screen.
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/twterm/screen.rb', line 10
def initialize(app, client)
@app, @client = app, client
@screen = init_screen
noecho
raw
curs_set(0)
stdscr.keypad(true)
start_color
use_default_colors
subscribe(Event::Screen::Resize, :resize)
end
|
Instance Method Details
#refresh ⇒ Object
24
25
26
27
28
|
# File 'lib/twterm/screen.rb', line 24
def refresh
app.tab_manager.refresh_window
app.tab_manager.current_tab.render
MessageWindow.instance.show
end
|
#respond_to_key(key) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/twterm/screen.rb', line 30
def respond_to_key(key)
k = KeyMapper.instance
case key
when k[:status, :compose]
app..compose
return
when k[:app, :quit], 3
app.quit
when k[:app, :cheatsheet]
tab = Tab::KeyAssignmentsCheatsheet.new(app, client)
app.tab_manager.add_and_show tab
else
return false
end
true
end
|
#wait ⇒ Object
49
50
51
52
53
54
|
# File 'lib/twterm/screen.rb', line 49
def wait
@thread = Thread.new do
loop { scan }
end
@thread.join
end
|