diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 1206cec5f6e9a..33f89ca39eb2b 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -287,8 +287,8 @@ void veh_interact::do_main_loop() bool redraw = false; int dx = 0; int dy = 0; - if(main_context.get_direction(dx, dy, action)) { - move_cursor(dx, dy); + if( main_context.get_direction( dx, dy, action ) ) { + move_cursor( dx, dy ); } else if( action == "QUIT" ) { finish = true; } else if( action == "INSTALL" ) { @@ -316,10 +316,8 @@ void veh_interact::do_main_loop() redraw = do_relabel( msg ); } else if ( action == "FUEL_LIST_DOWN" ) { move_fuel_cursor( 1 ); - move_cursor( 0, 0 ); } else if ( action == "FUEL_LIST_UP" ) { move_fuel_cursor( -1 ); - move_cursor( 0, 0 ); } else if ( action == "DESC_LIST_DOWN" ) { move_cursor( 0, 0, 1 ); } else if ( action == "DESC_LIST_UP" ) { @@ -344,8 +342,9 @@ void veh_interact::do_main_loop() werase( w_msg ); fold_and_print( w_msg, 0, 1, getmaxx( w_msg ) - 2, c_light_red, msg ); wrefresh( w_msg ); + } else { + move_cursor( 0, 0 ); } - } } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index df3ccaed0dd89..c78cefa1e7ed7 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2887,14 +2887,14 @@ int vehicle::print_part_list( const catacurses::window &win, int y1, const int m /** * Prints a list of descriptions for all parts to the screen inside of a boxed window - * highlighting a selected one. * @param win The window to draw in. * @param max_y Draw no further than this y-coordinate. * @param width The width of the window. * @param &p The index of the part being examined. * @param start_at Which vehicle part to start printing at. */ -void vehicle::print_vparts_descs( const catacurses::window &win, int max_y, int width, int &p, int start_at ) const +void vehicle::print_vparts_descs( const catacurses::window &win, int max_y, int width, int &p, + int &start_at ) const { if( p < 0 || p >= ( int )parts.size() ) { return; @@ -2904,7 +2904,9 @@ void vehicle::print_vparts_descs( const catacurses::window &win, int max_y, int std::ostringstream msg; int lines = 0; - start_at = std::max( start_at, 0 ); + /* never start before the start of the list */ + /* guess the number of entries that can fit in the window, and don't scroll past that */ + start_at = std::min( std::max( start_at, 0 ), max_y / 6 ); if( start_at ) { msg << "" << "< " << _( "More parts here..." ) << "\n"; lines += 1; diff --git a/src/vehicle.h b/src/vehicle.h index 546589c91179b..db9d7281992f6 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -581,7 +581,7 @@ class vehicle // Vehicle parts descriptions - descriptions for all the parts on a single tile void print_vparts_descs( const catacurses::window &win, int max_y, int width, int &p, - int start_at ) const; + int &start_at ) const; /** * Operate vehicle controls