@@ -988,6 +988,7 @@ struct refresh_status_bars {
988988 {
989989 static auto * breadcrumb_view = injector::get<breadcrumb_curses*>();
990990 static auto & prompt = lnav::prompt::get ();
991+ static auto & exec_phase = injector::get<lnav::exec_phase&>();
991992 static const auto cancel_msg
992993 = lnav::console::user_message::info (
993994 attr_line_t (" performing operation, press " )
@@ -1003,33 +1004,33 @@ struct refresh_status_bars {
10031004 }
10041005
10051006 gettimeofday (¤t_time, nullptr );
1006- while (notcurses_get_nblock (this ->rsb_screen ->get_notcurses (), &ch) > 0 )
1007- {
1008- lnav_data.ld_user_message_source .clear ();
1009-
1010- alerter::singleton ().new_input (ch);
1011-
1012- lnav_data.ld_input_dispatcher .new_input (
1013- current_time, this ->rsb_screen ->get_notcurses (), ch);
1014-
1015- lnav_data.ld_view_stack .top () | [ch](auto tc) {
1016- lnav_data.ld_key_repeat_history .update (ch.id , tc->get_top ());
1017- };
1018-
1019- if (ncinput_ctrl_p (&ch) && ch.id == ' ]' ) {
1020- lnav_data.ld_bottom_source .update_loading (0 , 0 );
1021- lnav_data.ld_status [LNS_BOTTOM ].set_needs_update ();
1022- retval = lnav::progress_result_t ::interrupt;
1023- }
1007+ auto time_diff = current_time - this ->rsb_last_loop_read_time ;
1008+ if (to_us (time_diff) > (exec_phase.interactive () ? 100ms : 2s)) {
1009+ while (notcurses_get_nblock (this ->rsb_screen ->get_notcurses (), &ch)
1010+ > 0 )
1011+ {
1012+ lnav_data.ld_user_message_source .clear ();
1013+ if ((!exec_phase.interactive () && ch.id == ' q' )
1014+ || (ncinput_ctrl_p (&ch) && ch.id == ' ]' ))
1015+ {
1016+ lnav_data.ld_bottom_source .update_loading (0 , 0 );
1017+ lnav_data.ld_status [LNS_BOTTOM ].set_needs_update ();
1018+ retval = lnav::progress_result_t ::interrupt;
1019+ } else {
1020+ log_warning (
1021+ " ignoring input while refreshing status bars: %x" ,
1022+ ch.id );
1023+ }
10241024
1025- ncinput_free_paste_content (&ch);
1025+ ncinput_free_paste_content (&ch);
10261026
1027- if (!lnav_data.ld_looping ) {
1028- // No reason to keep processing input after the
1029- // user has quit. The view stack will also be
1030- // empty, which will cause issues.
1031- retval = lnav::progress_result_t ::interrupt;
1032- break ;
1027+ if (!lnav_data.ld_looping ) {
1028+ // No reason to keep processing input after the
1029+ // user has quit. The view stack will also be
1030+ // empty, which will cause issues.
1031+ retval = lnav::progress_result_t ::interrupt;
1032+ break ;
1033+ }
10331034 }
10341035 }
10351036
@@ -1084,6 +1085,7 @@ struct refresh_status_bars {
10841085
10851086 screen_curses* rsb_screen;
10861087 std::shared_ptr<top_status_source> rsb_top_source;
1088+ timeval rsb_last_loop_read_time{0 };
10871089};
10881090
10891091static void
@@ -2274,6 +2276,7 @@ VALUES ('org.lnav.mouse-support', -1, DATETIME('now', '+1 minute'),
22742276 gettimeofday (¤t_time, nullptr );
22752277 ui_now = ui_clock::now ();
22762278 lb.tick (current_time);
2279+ refresher->rsb_last_loop_read_time = current_time;
22772280
22782281 got_user_input = false ;
22792282 if (rc < 0 ) {
0 commit comments