Class: Twterm::Screen
- Inherits:
-
Object
show all
- Includes:
- Curses, Singleton, Subscriber
- Defined in:
- lib/twterm/screen.rb
Instance Method Summary
collapse
Methods included from Subscriber
included, #subscribe, #unsubscribe
Constructor Details
#initialize ⇒ Screen
Returns a new instance of Screen.
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/twterm/screen.rb', line 10
def initialize
@screen = init_screen
noecho
cbreak
curs_set(0)
stdscr.keypad(true)
start_color
use_default_colors
subscribe(Event::Screen::Resize, :resize)
end
|
Instance Method Details
#refresh ⇒ Object
22
23
24
25
26
|
# File 'lib/twterm/screen.rb', line 22
def refresh
TabManager.instance.refresh_window
TabManager.instance.current_tab.refresh
Notifier.instance.show
end
|
#respond_to_key(key) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/twterm/screen.rb', line 28
def respond_to_key(key)
case key
when ?n
Tweetbox.instance.compose
return
when ?Q
App.instance.quit
when ??
tab = Tab::KeyAssignmentsCheatsheet.new
TabManager.instance.add_and_show tab
else
return false
end
true
end
|
#wait ⇒ Object
45
46
47
48
49
50
|
# File 'lib/twterm/screen.rb', line 45
def wait
@thread = Thread.new do
loop { scan }
end
@thread.join
end
|