Class: Twterm::Tab::New::Search
Constant Summary
collapse
- @@queries =
Concurrent::Array.new
Instance Method Summary
collapse
Methods included from Searchable
#matches?, #search_query_window
Methods included from Scrollable
#scroller
Methods included from Publisher
#publish
Methods included from Utils
check_type
Methods included from Loadable
#initially_loaded!, #initially_loaded?
Methods inherited from AbstractTab
#close, #find_or_fetch_list, #find_or_fetch_status, #find_or_fetch_user, #render
Methods included from Subscriber
included, #subscribe, #unsubscribe
Constructor Details
#initialize(app, client) ⇒ Search
Returns a new instance of Search.
27
28
29
30
31
|
# File 'lib/twterm/tab/new/search.rb', line 27
def initialize(app, client)
super(app, client)
update_saved_search
end
|
Instance Method Details
#==(other) ⇒ Object
19
20
21
|
# File 'lib/twterm/tab/new/search.rb', line 19
def ==(other)
other.is_a?(self.class)
end
|
#drawable_item_count ⇒ Object
23
24
25
|
# File 'lib/twterm/tab/new/search.rb', line 23
def drawable_item_count
(window.maxy - 6).div(3)
end
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/twterm/tab/new/search.rb', line 33
def invoke_input
resetter = proc do
Curses.reset_prog_mode
sleep 0.1
publish(Event::Screen::Refresh.new)
end
input_thread = Thread.new do
Curses.close_screen
app.completion_manager.set_search_mode!
puts "\ninput search query"
query = (readline('> ', true) || '').strip
resetter.call
tab = query.nil? || query.empty? ? Tab::New::Search.new(app, client) : Tab::Statuses::Search.new(app, client, query)
app.tab_manager.switch(tab)
end
app.register_interruption_handler do
input_thread.kill
resetter.call
tab = Tab::New::Search.new
app.tab_manager.switch(tab)
end
input_thread.join
end
|
#items ⇒ Object
61
62
63
|
# File 'lib/twterm/tab/new/search.rb', line 61
def items
['<Input search query>', *@@queries]
end
|
#respond_to_key(key) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/twterm/tab/new/search.rb', line 65
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10
open_search_tab_with_current_query
else
return false
end
true
end
|
#title ⇒ Object
78
79
80
|
# File 'lib/twterm/tab/new/search.rb', line 78
def title
'New tab'.freeze
end
|
#total_item_count ⇒ Object
Also known as:
count
82
83
84
|
# File 'lib/twterm/tab/new/search.rb', line 82
def total_item_count
items.count
end
|