@@ -576,52 +576,61 @@ impl Sidebar {
576576
577577 match config. sidebar . position {
578578 sidebar:: Position :: Left | sidebar:: Position :: Right => {
579- let nicklist: Option < Element < ' a , Message > > = if config
580- . sidebar
581- . show_nicklist
582- && !self . nicklist_hidden
583- {
584- focused_channel_nicklist (
579+ let show_nicklist =
580+ config. sidebar . show_nicklist && !self . nicklist_hidden ;
581+
582+ let direction = scrollable:: Direction :: Vertical (
583+ scrollable:: Scrollbar :: default ( )
584+ . width ( config. sidebar . scrollbar . width )
585+ . scroller_width (
586+ config. sidebar . scrollbar . scroller_width ,
587+ ) ,
588+ ) ;
589+
590+ let mut nicklist: Option < Element < ' a , Message > > = None ;
591+ let mut buflist_content =
592+ Column :: with_children ( buffers) . spacing ( 0 ) ;
593+
594+ if show_nicklist
595+ && let Some ( list) = focused_channel_nicklist (
585596 panes, focus, clients, config, theme, width,
586597 )
587- . map ( |list| {
588- container ( list)
589- . padding ( [ 0 , 2 ] )
590- . height ( if config. sidebar . split {
591- Length :: FillPortion (
598+ {
599+ if config. sidebar . split {
600+ let scrollable = Scrollable :: new ( list)
601+ . direction ( direction)
602+ . width ( Length :: Shrink ) ;
603+
604+ nicklist = Some (
605+ container ( scrollable)
606+ . padding ( [ 0 , 2 ] )
607+ . height ( Length :: FillPortion (
592608 config. sidebar . nicklist_space ,
593- )
594- } else {
595- Length :: Fill
596- } )
597- . into ( )
598- } )
599- } else {
600- None
601- } ;
609+ ) )
610+ . into ( ) ,
611+ ) ;
612+ } else {
613+ buflist_content = buflist_content
614+ . push ( container ( list) . padding ( [ 0 , 2 ] ) ) ;
615+ }
616+ }
602617
603618 let buflist_height =
604619 if config. sidebar . split && nicklist. is_some ( ) {
605620 Length :: FillPortion ( config. sidebar . buflist_space )
606- } else if nicklist. is_some ( ) {
607- Length :: Shrink
608621 } else {
609622 Length :: Fill
610623 } ;
611624
612- let buflist = Scrollable :: new (
613- Column :: with_children ( buffers) . spacing ( 0 ) ,
614- )
615- . direction ( scrollable:: Direction :: Vertical (
616- scrollable:: Scrollbar :: default ( )
617- . width ( config. sidebar . scrollbar . width )
618- . scroller_width (
619- config. sidebar . scrollbar . scroller_width ,
620- ) ,
621- ) )
622- . height ( buflist_height) ;
625+ let buflist = Scrollable :: new ( buflist_content)
626+ . direction ( direction)
627+ . height ( buflist_height) ;
623628
624- let content = column ! [ buflist, nicklist, user_menu_button, ] ;
629+ let content = if show_nicklist && !config. sidebar . split {
630+ column ! [ buflist, user_menu_button]
631+ } else {
632+ column ! [ buflist, nicklist, user_menu_button]
633+ } ;
625634
626635 container ( content)
627636 }
@@ -720,7 +729,7 @@ fn focused_channel_nicklist<'a>(
720729
721730 let users = clients. get_channel_users ( server, channel) ;
722731 let prefix = clients. get_prefix ( server) ;
723- let list = crate :: buffer:: channel:: nick_list:: view (
732+ let list = crate :: buffer:: channel:: nick_list:: content (
724733 server, prefix, channel, users, None , config, theme,
725734 )
726735 . map ( Message :: Nicklist ) ;
0 commit comments