@@ -29,10 +29,14 @@ impl View for SessionView {
2929 KeyCode :: Tab => return Some ( AppEvent :: NextPane ) ,
3030 KeyCode :: Enter => return Some ( AppEvent :: ToggleFullscreen ) ,
3131 KeyCode :: Char ( char) => match char {
32- 'j' => return Some ( AppEvent :: ScrollDown ( 1 ) ) ,
33- 'k' => return Some ( AppEvent :: ScrollUp ( 1 ) ) ,
34- 'J' => return Some ( AppEvent :: ScrollDown ( 10 ) ) ,
35- 'K' => return Some ( AppEvent :: ScrollUp ( 10 ) ) ,
32+ 'j' => return Some ( AppEvent :: Scroll ( ( 1 , 0 ) ) ) ,
33+ 'k' => return Some ( AppEvent :: Scroll ( ( -1 , 0 ) ) ) ,
34+ 'J' => return Some ( AppEvent :: Scroll ( ( 10 , 0 ) ) ) ,
35+ 'K' => return Some ( AppEvent :: Scroll ( ( -10 , 0 ) ) ) ,
36+ 'l' => return Some ( AppEvent :: Scroll ( ( 0 , 1 ) ) ) ,
37+ 'L' => return Some ( AppEvent :: Scroll ( ( 0 , 10 ) ) ) ,
38+ 'h' => return Some ( AppEvent :: Scroll ( ( 0 , -1 ) ) ) ,
39+ 'H' => return Some ( AppEvent :: Scroll ( ( 0 , -10 ) ) ) ,
3640 '0' ..='9' => return Some ( AppEvent :: PushInputPlurality ( char) ) ,
3741 _ => ( ) ,
3842 } ,
@@ -74,7 +78,13 @@ impl View for SessionView {
7478
7579 fn draw ( app : & App , frame : & mut Frame , area : ratatui:: prelude:: Rect ) {
7680 if app. session_view . full_screen {
77- build_pane_widget ( frame, app, app. session_view . current_pane ( ) , area, app. session_view . current_pane ) ;
81+ build_pane_widget (
82+ frame,
83+ app,
84+ app. session_view . current_pane ( ) ,
85+ area,
86+ app. session_view . current_pane ,
87+ ) ;
7888 return ;
7989 }
8090
@@ -122,12 +132,10 @@ fn build_pane_widget(frame: &mut Frame, app: &App, pane: &Pane, area: Rect, inde
122132 ComponentType :: Context => format ! ( "Context({})" , app. context_depth) ,
123133 ComponentType :: Stack => "Stack" . to_string ( ) ,
124134 } )
125- . style (
126- match index == app. session_view . current_pane {
127- true => app. theme ( ) . pane_border_active ,
128- false => app. theme ( ) . pane_border_inactive ,
129- }
130- ) ;
135+ . style ( match index == app. session_view . current_pane {
136+ true => app. theme ( ) . pane_border_active ,
137+ false => app. theme ( ) . pane_border_inactive ,
138+ } ) ;
131139
132140 frame. render_widget ( & block, area) ;
133141
@@ -146,9 +154,9 @@ fn build_pane_widget(frame: &mut Frame, app: &App, pane: &Pane, area: Rect, inde
146154
147155pub struct SessionViewState {
148156 pub full_screen : bool ,
149- pub source_scroll : Option < i16 > ,
150- pub context_scroll : u16 ,
151- pub stack_scroll : u16 ,
157+ pub source_scroll : ( u16 , u16 ) ,
158+ pub context_scroll : ( u16 , u16 ) ,
159+ pub stack_scroll : ( u16 , u16 ) ,
152160 pub mode : SessionViewMode ,
153161 pub panes : Vec < Pane > ,
154162 pub current_pane : usize ,
@@ -164,9 +172,9 @@ impl SessionViewState {
164172 pub fn new ( ) -> Self {
165173 Self {
166174 full_screen : false ,
167- source_scroll : None ,
168- context_scroll : 0 ,
169- stack_scroll : 0 ,
175+ source_scroll : ( 0 , 0 ) ,
176+ context_scroll : ( 0 , 0 ) ,
177+ stack_scroll : ( 0 , 0 ) ,
170178 current_pane : 0 ,
171179 mode : SessionViewMode :: Current ,
172180 panes : vec ! [
@@ -196,8 +204,9 @@ impl SessionViewState {
196204 }
197205
198206 pub ( crate ) fn reset ( & mut self ) {
199- self . context_scroll = 0 ;
200- self . source_scroll = None ;
207+ self . context_scroll = ( 0 , 0 ) ;
208+ self . stack_scroll = ( 0 , 0 ) ;
209+ self . source_scroll = ( 0 , 0 ) ;
201210 }
202211}
203212
0 commit comments