@@ -51,8 +51,16 @@ impl View for SourceComponent {
5151 . analyzed_files
5252 . get ( & stack. source . filename . to_string ( ) ) ;
5353
54- for ( line_no, line) in stack. source . source . lines ( ) . enumerate ( ) {
55- let is_current_line = stack. source . line_no == line_no as u32 + 1 ;
54+
55+ // trunacte the hidden lines
56+ let truncate_until = app. session_view . source_scroll . 0 as u32 + 1 ;
57+
58+ for ( line_offset, line) in stack. source . source . lines ( ) . enumerate ( ) {
59+ let line_no = line_offset + 1 ;
60+ if ( line_no as u32 ) < truncate_until {
61+ continue
62+ }
63+ let is_current_line = stack. source . line_no == line_no as u32 ;
5664
5765 lines. push ( Line :: from ( vec ! [
5866 Span :: styled( format!( "{:<6}" , line_no) , app. theme( ) . source_line_no) ,
@@ -68,7 +76,7 @@ impl View for SourceComponent {
6876
6977 if is_current_line {
7078 if let Some ( analysis) = analysis {
71- for ( _, var) in analysis. row ( line_no ) {
79+ for ( _, var) in analysis. row ( line_offset ) {
7280 let property = stack. get_property ( var. name . as_str ( ) ) ;
7381 if property. is_none ( ) {
7482 continue ;
@@ -82,7 +90,7 @@ impl View for SourceComponent {
8290 if labels. len ( ) > 1 {
8391 labels. pop ( ) ;
8492 annotations. push ( (
85- line_no + 1 ,
93+ line_offset ,
8694 line. len ( ) + 8 ,
8795 Line :: from ( labels) . style ( app. theme ( ) . source_annotation ) ,
8896 ) ) ;
@@ -92,15 +100,15 @@ impl View for SourceComponent {
92100 }
93101
94102 frame. render_widget (
95- Paragraph :: new ( lines. clone ( ) ) . scroll ( app . session_view . source_scroll ) ,
103+ Paragraph :: new ( lines. clone ( ) ) ,
96104 rows[ 0 ] ,
97105 ) ;
98106
99- for ( line_no , line_length, line) in annotations {
107+ for ( line_offset , line_length, line) in annotations {
100108 let x_offset = rows[ 0 ] . x + ( line_length as u16 ) . saturating_sub ( app. session_view . source_scroll . 1 ) ;
101109 let area = Rect {
102110 x : x_offset,
103- y : ( line_no as u32 ) . saturating_sub ( app. session_view . source_scroll . 0 as u32 ) as u16 + 1 ,
111+ y : rows [ 0 ] . y + ( ( line_offset as u32 ) . saturating_sub ( app. session_view . source_scroll . 0 as u32 ) as u16 ) ,
104112 width : rows[ 0 ] . width . saturating_sub ( x_offset) ,
105113 height : 1 ,
106114 } ;
0 commit comments