@@ -64,10 +64,8 @@ pub async fn invoke(args: &[String], ctx: &mut Context) -> Result<String> {
6464 None | Some ( Err ( _) ) => break ,
6565 Some ( Ok ( msg) ) => if let Model :: Frame ( lh_frame) = msg. payload {
6666 terminal. draw( |frame| {
67- let canvas = draw_to_canvas (
67+ let canvas = lh_frame_canvas (
6868 lh_frame,
69- frame. size( ) . width. into( ) ,
70- frame. size( ) . height. into( ) ,
7169 format!( "{} ({}: quit)" , path, QUIT_KEY ) ,
7270 ) ;
7371 frame. render_widget( canvas, frame. size( ) ) ;
@@ -85,7 +83,7 @@ pub async fn invoke(args: &[String], ctx: &mut Context) -> Result<String> {
8583 Ok ( String :: new ( ) )
8684}
8785
88- fn draw_to_canvas ( frame : Frame , max_width : f64 , max_height : f64 , title : String ) -> impl Widget {
86+ fn lh_frame_canvas ( lh_frame : Frame , title : String ) -> impl Widget {
8987 Canvas :: default ( )
9088 . block (
9189 Block :: bordered ( )
@@ -97,7 +95,7 @@ fn draw_to_canvas(frame: Frame, max_width: f64, max_height: f64, title: String)
9795 . paint ( move |ctx| {
9896 for y in 0 ..LIGHTHOUSE_ROWS {
9997 for x in 0 ..LIGHTHOUSE_COLS {
100- let c = frame . get ( x, y) ;
98+ let c = lh_frame . get ( x, y) ;
10199 ctx. draw ( & Rectangle {
102100 x : x as f64 ,
103101 y : ( LIGHTHOUSE_ROWS - 1 - y) as f64 ,
@@ -110,8 +108,8 @@ fn draw_to_canvas(frame: Frame, max_width: f64, max_height: f64, title: String)
110108 }
111109 }
112110 } )
113- . x_bounds ( [ 0.0 , max_width ] )
114- . y_bounds ( [ 0.0 , max_height ] )
111+ . x_bounds ( [ 0.0 , LIGHTHOUSE_COLS as f64 ] )
112+ . y_bounds ( [ 0.0 , LIGHTHOUSE_ROWS as f64 ] )
115113}
116114
117115fn key_code_to_js ( key_code : KeyCode ) -> Option < i32 > {
0 commit comments