File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,18 @@ impl Widget for &mut App<'_> {
184184 }
185185 let chat_len = messages. len ( ) ;
186186
187+ if self
188+ . ui
189+ . history_state
190+ . selected
191+ . is_some_and ( |idx| idx >= chat_len)
192+ && chat_len >= 1
193+ {
194+ self . ui . history_state . selected = Some ( chat_len - 1 ) ;
195+ } else if chat_len == 0 {
196+ self . ui . history_state . selected = None ;
197+ }
198+
187199 let builder = ListBuilder :: new ( |context| {
188200 if let Some ( mut item) = messages. get ( context. index ) . cloned ( ) {
189201 item. is_selected = context. is_selected ;
@@ -204,7 +216,7 @@ impl Widget for &mut App<'_> {
204216 . thumb_symbol ( "▐" ) ,
205217 )
206218 . infinite_scrolling ( false )
207- . scroll_padding ( 2 ) ;
219+ . scroll_padding ( 0 ) ;
208220
209221 list. render ( layout. chat_area , buf, & mut self . ui . history_state ) ;
210222
You can’t perform that action at this time.
0 commit comments