11use crate :: environment:: * ;
2+ use crate :: focus:: get_focus_dir;
3+ use crate :: focus:: get_focus_session;
24use crate :: location:: Location ;
35use enum_map:: enum_map;
46
@@ -12,6 +14,15 @@ pub fn generate_title(location: &Location) -> String {
1214 } ;
1315 } ( & location) ;
1416
17+ let format_extra_info = |info : Option < String > , title : & str | -> String {
18+ return match info {
19+ Some ( ri) => format ! ( "{}: {} " , & title, & ri, ) ,
20+ None => String :: from ( "" ) ,
21+ } ;
22+ } ;
23+ let focus_session = format_extra_info ( get_focus_session ( ) , "Session" ) ;
24+ let focus_dir = format_extra_info ( get_focus_dir ( ) , "Directory" ) ;
25+
1526 let location_map = enum_map ! {
1627 Location :: Session => "Session location history" ,
1728 Location :: Directory => "Directory location history" ,
@@ -22,28 +33,30 @@ pub fn generate_title(location: &Location) -> String {
2233 let header_map = enum_map ! {
2334 Location :: Session =>
2435" ┏━━━━━━━━━━━┱─────────────┬────────┬──────────────┐
25- ┃F1: Session┃F2: Directory│F3: Host│F4: Everywhere│ F5: Toggle group
26- ━┛ ┗━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━" ,
36+ ┃F1: Session┃F2: Directory│F3: Host│F4: Everywhere│ F5: Toggle group, F6: Lock Session, F7: Lock Dir
37+ ━┛ ┗━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " ,
2738 Location :: Directory =>
2839" ┌───────────┲━━━━━━━━━━━━━┱────────┬──────────────┐
29- │F1: Session┃F2: Directory┃F3: Host│F4: Everywhere│ F5: Toggle group
30- ━┷━━━━━━━━━━━┛ ┗━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━" ,
40+ │F1: Session┃F2: Directory┃F3: Host│F4: Everywhere│ F5: Toggle group, F6: Lock Session, F7: Lock Dir
41+ ━┷━━━━━━━━━━━┛ ┗━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " ,
3142
3243 Location :: Machine =>
3344" ┌───────────┬─────────────┲━━━━━━━━┱──────────────┐
34- │F1: Session│F2: Directory┃F3: Host┃F4: Everywhere│ F5: Toggle group
35- ━┷━━━━━━━━━━━┷━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━" ,
45+ │F1: Session│F2: Directory┃F3: Host┃F4: Everywhere│ F5: Toggle group, F6: Lock Session, F7: Lock Dir
46+ ━┷━━━━━━━━━━━┷━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " ,
3647
3748 Location :: Everywhere =>
3849" ┌───────────┬─────────────┬────────┲━━━━━━━━━━━━━━┓
39- │F1: Session│F2: Directory│F3: Host┃F4: Everywhere┃ F5: Toggle group
40- ━┷━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━" ,
50+ │F1: Session│F2: Directory│F3: Host┃F4: Everywhere┃ F5: Toggle group, F6: Lock Session, F7: Lock Dir
51+ ━┷━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " ,
4152 } ;
4253
4354 let title = format ! (
44- "{} {}\n {}\n " ,
55+ "{} {} {}{} \n {}\n " ,
4556 & location_map[ location. clone( ) ] ,
4657 & extra_info,
58+ & focus_session,
59+ & focus_dir,
4760 & header_map[ location. clone( ) ] ,
4861 ) ;
4962 return title. to_string ( ) ;
0 commit comments