@@ -285,13 +285,17 @@ def __init__(self) -> None:
285
285
class StreamsView (urwid .Frame ):
286
286
def __init__ (self , streams_btn_list : List [Any ], view : Any ) -> None :
287
287
self .view = view
288
- self . log = urwid . SimpleFocusListWalker ( streams_btn_list )
288
+ # Create Stream List Box
289
289
self .streams_btn_list = streams_btn_list
290
- self .focus_index_before_search = 0
290
+ self .log = urwid . SimpleFocusListWalker ( streams_btn_list )
291
291
list_box = urwid .ListBox (self .log )
292
+ # Create Stream Search Box
292
293
self .stream_search_box = PanelSearchBox (
293
294
self , "SEARCH_STREAMS" , self .update_streams
294
295
)
296
+ self .focus_index_before_search = 0
297
+ self .in_search_mode = False
298
+ # Create Stream View Frame
295
299
super ().__init__ (
296
300
list_box ,
297
301
header = urwid .LineBox (
@@ -364,6 +368,7 @@ def mouse_event(
364
368
365
369
def keypress (self , size : urwid_Size , key : str ) -> Optional [str ]:
366
370
if is_command_key ("SEARCH_STREAMS" , key ):
371
+ self .in_search_mode = True
367
372
self .set_focus ("header" )
368
373
return key
369
374
elif is_command_key ("GO_BACK" , key ):
@@ -373,9 +378,11 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
373
378
self .set_focus ("body" )
374
379
self .log .set_focus (self .focus_index_before_search )
375
380
self .view .controller .update_screen ()
381
+ self .in_search_mode = False
376
382
return key
377
383
return_value = super ().keypress (size , key )
378
- _ , self .focus_index_before_search = self .log .get_focus ()
384
+ if not self .in_search_mode :
385
+ _ , self .focus_index_before_search = self .log .get_focus ()
379
386
return return_value
380
387
381
388
@@ -384,17 +391,21 @@ def __init__(
384
391
self , topics_btn_list : List [Any ], view : Any , stream_button : Any
385
392
) -> None :
386
393
self .view = view
387
- self .log = urwid .SimpleFocusListWalker (topics_btn_list )
388
- self .topics_btn_list = topics_btn_list
389
394
self .stream_button = stream_button
390
- self .focus_index_before_search = 0
395
+ # Create Topic List Box
396
+ self .topics_btn_list = topics_btn_list
397
+ self .log = urwid .SimpleFocusListWalker (topics_btn_list )
391
398
self .list_box = urwid .ListBox (self .log )
399
+ # Create Topic Search Box
392
400
self .topic_search_box = PanelSearchBox (
393
401
self , "SEARCH_TOPICS" , self .update_topics
394
402
)
403
+ self .focus_index_before_search = 0
404
+ self .in_search_mode = False
395
405
self .header_list = urwid .Pile (
396
406
[self .stream_button , urwid .Divider ("─" ), self .topic_search_box ]
397
407
)
408
+ # Create Topic View Frame
398
409
super ().__init__ (
399
410
self .list_box ,
400
411
header = urwid .LineBox (
@@ -476,6 +487,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
476
487
self .view .show_left_panel (visible = False )
477
488
self .view .body .focus_col = 1
478
489
if is_command_key ("SEARCH_TOPICS" , key ):
490
+ self .in_search_mode = True
479
491
self .set_focus ("header" )
480
492
self .header_list .set_focus (2 )
481
493
return key
@@ -486,9 +498,11 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
486
498
self .set_focus ("body" )
487
499
self .log .set_focus (self .focus_index_before_search )
488
500
self .view .controller .update_screen ()
501
+ self .in_search_mode = False
489
502
return key
490
503
return_value = super ().keypress (size , key )
491
- _ , self .focus_index_before_search = self .log .get_focus ()
504
+ if not self .in_search_mode :
505
+ _ , self .focus_index_before_search = self .log .get_focus ()
492
506
return return_value
493
507
494
508
0 commit comments