@@ -50,30 +50,76 @@ def draw_file_name
5050 end
5151
5252 def draw_stats
53- filtered_requests = state . filtered_requests
54- total_requests = state . requests . size
55-
5653 if state . main_filter . present?
57- # Filter active - show "X found (Y total)"
58- stats_text = "#{ filtered_requests . size } found (#{ total_requests } total)"
59- header_win . setpos ( 1 , screen . width - stats_text . length - 2 )
60- header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( filtered_requests . size . to_s ) }
61- header_win . addstr ( " found (" )
62- header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( total_requests . to_s ) }
63- header_win . addstr ( " total)" )
54+ draw_filtered_stats
6455 else
65- # No filter active - show simple count
66- stats_text = "Requests: #{ total_requests } "
67- header_win . setpos ( 1 , screen . width - stats_text . length - 2 )
68- header_win . addstr ( "Requests: " )
69- header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( total_requests . to_s ) }
56+ draw_stats_panel
7057 end
7158 end
7259
60+ def draw_filtered_stats
61+ # When filter is active, show compact "X found (Y total)" on line 1
62+ filtered_requests = state . filtered_requests
63+ total_requests = state . requests . size
64+ stats_text = "#{ filtered_requests . size } found (#{ total_requests } total)"
65+ header_win . setpos ( 1 , screen . width - stats_text . length - 2 )
66+ header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( filtered_requests . size . to_s ) }
67+ header_win . addstr ( " found (" )
68+ header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( total_requests . to_s ) }
69+ header_win . addstr ( " total)" )
70+ end
71+
72+ def draw_stats_panel
73+ # Calculate stats
74+ total_requests = state . requests . size
75+ total_queries = state . total_queries
76+ req_per_sec = state . requests_per_second
77+ req_per_min = state . requests_per_minute
78+ queries_per_sec = state . queries_per_second
79+ queries_per_min = state . queries_per_minute
80+
81+ # Calculate width for alignment
82+ header_text = " Total | sec | min"
83+ max_width = header_text . length
84+ start_x = screen . width - max_width - 2
85+
86+ # Draw header line (dimmed)
87+ header_win . setpos ( 1 , start_x )
88+ header_win . attron ( A_DIM ) { header_win . addstr ( header_text ) }
89+
90+ # Draw requests line
91+ header_win . setpos ( 2 , start_x )
92+ draw_stats_line ( "Req: " , total_requests , req_per_sec , req_per_min )
93+
94+ # Draw queries line
95+ header_win . setpos ( 3 , start_x )
96+ draw_stats_line ( "Query: " , total_queries , queries_per_sec , queries_per_min )
97+ end
98+
99+ def draw_stats_line ( label , total , per_sec , per_min )
100+ # Draw label
101+ header_win . addstr ( label )
102+
103+ # Draw total (highlighted, right-aligned in 6 chars)
104+ total_str = format ( "%6d" , total )
105+ header_win . attron ( color_pair ( SUCCESS_GREEN ) ) { header_win . addstr ( total_str ) }
106+ header_win . addstr ( " | " )
107+
108+ # Draw per second (highlighted, right-aligned in 3 chars)
109+ per_sec_str = format ( "%3.0f" , per_sec )
110+ header_win . attron ( color_pair ( SUCCESS_GREEN ) ) { header_win . addstr ( per_sec_str ) }
111+ header_win . addstr ( " | " )
112+
113+ # Draw per minute (highlighted, right-aligned in 3 chars)
114+ per_min_str = format ( "%3.0f" , per_min )
115+ header_win . attron ( color_pair ( SUCCESS_GREEN ) ) { header_win . addstr ( per_min_str ) }
116+ end
117+
73118 def draw_help_text
74119 header_win . setpos ( 2 , 2 )
75120 header_win . attron ( A_DIM ) do
76- header_win . addstr ( "a:Auto-scroll(" )
121+ help_line_1 = "a:Auto-scroll("
122+ header_win . addstr ( help_line_1 )
77123 header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( state . auto_scroll ? "ON" : "OFF" ) }
78124 header_win . addstr ( ") | f:Filter | c:Clear filter | s:Sort(" )
79125 header_win . attron ( color_pair ( 3 ) ) { header_win . addstr ( state . sort . display_name ) }
0 commit comments