29
30
31
32
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/entry_controller.rb', line 29
def parse_entry_page_command
LOGGER.debug "Waiting for entry page command"
c = @scr.getch
LOGGER.debug("Entry Page getch: #{c}")
c, buffer = key_buffer(c)
multiplier = buffer.empty? ? 1 : buffer.join.to_i
case c
when "?"[0] @content_area.close
show_help(CursesController::ENTRY_PAGE_COMMANDS)
@scr.clear
@scr.refresh
set_content_area
@content_area.draw
return
when ?\q
exit
when '-'[0], Key::LEFT, ?h
@content_area.close
show_entries
return :exit
when ?\/
when Key::UP, ?k, ?p, control_key('B'), Key::PPAGE
if @content_area.prev_page == :exit
@content_area.close
show_entries
return :exit
end
when Key::DOWN, ?j, ?\s, ?n, control_key('F'), Key::NPAGE
if @content_area.next_page == :exit
@content_area.close
show_entries
return :exit
end
when '<'[0], ','[0] if @current_entry_index > 0
@current_entry_index -= 1
@current_entry = @current_entries[@current_entry_index]
@content_area.close
set_content_area
end
when '>'[0], '.'[0] if @current_entry_index < @current_entries.size - 1
@current_entry_index += 1
@current_entry = @current_entries[@current_entry_index]
@content_area.close
set_content_area
end
when Key::RESIZE
content = @content_area.content
@content_area.close
set_content_area
@content_area.content = content
when '*'[0], 's'[0] @content_area.toggle_flag
when '\\'[0]
unless @raw_content_mode
@content_area.close
@content_area = EntryWindow.new(@scr,
@formatter.display_feed(@current_entry),
@formatter.display_title(@current_entry),
@formatter.display_raw_entry_content(@current_entry),
@current_entry, @global_search_string)
@raw_content_mode = true
else @content_area.close
set_content_area
@raw_content_mode = false
end
when ?l, Key::RIGHT, 10 command = (ENV['FASTREADER_WEB'] || "open") + " #{@current_entry.url.strip}"
`#{command}`
when 'G'[0] if buffer.last == 1
@content_area.end
else
@content_area.beginning
end
else
end
end
|