1+ use crate :: cli:: StyleMode ;
12use anyhow:: Result ;
23use futures_util:: { stream, Stream , StreamExt } ;
34use serde_json:: json;
@@ -13,11 +14,12 @@ pub struct Session {
1314 start_time : Instant ,
1415 last_event_time : Instant ,
1516 pending_pid : Option < i32 > ,
17+ style_mode : StyleMode ,
1618}
1719
1820#[ derive( Clone , Debug ) ]
1921pub enum Event {
20- Init ( f64 , usize , usize , String , String ) ,
22+ Init ( f64 , usize , usize , i32 , String , String ) ,
2123 Output ( f64 , String ) ,
2224 Resize ( f64 , usize , usize ) ,
2325 Snapshot ( usize , usize , String , String ) ,
@@ -46,6 +48,7 @@ impl Session {
4648 start_time : now,
4749 last_event_time : now,
4850 pending_pid : None ,
51+ style_mode : StyleMode :: Plain ,
4952 }
5053 }
5154
@@ -107,7 +110,11 @@ impl Session {
107110 }
108111
109112 pub fn cursor_key_app_mode ( & self ) -> bool {
110- self . vt . arrow_key_app_mode ( )
113+ self . vt . cursor_key_app_mode ( )
114+ }
115+
116+ pub fn set_style_mode ( & mut self , style_mode : StyleMode ) {
117+ self . style_mode = style_mode;
111118 }
112119
113120 pub fn subscribe ( & self ) -> Subscription {
@@ -117,6 +124,7 @@ impl Session {
117124 self . elapsed_time ( ) ,
118125 cols,
119126 rows,
127+ self . pending_pid . unwrap_or ( 0 ) ,
120128 self . vt . dump ( ) ,
121129 self . text_view ( ) ,
122130 ) ;
@@ -148,11 +156,12 @@ impl Session {
148156impl Event {
149157 pub fn to_json ( & self ) -> serde_json:: Value {
150158 match self {
151- Event :: Init ( _time, cols, rows, seq, text) => json ! ( {
159+ Event :: Init ( _time, cols, rows, pid , seq, text) => json ! ( {
152160 "type" : "init" ,
153161 "data" : json!( {
154162 "cols" : cols,
155163 "rows" : rows,
164+ "pid" : pid,
156165 "seq" : seq,
157166 "text" : text,
158167 } )
@@ -215,7 +224,7 @@ impl Event {
215224}
216225
217226fn build_vt ( cols : usize , rows : usize ) -> avt:: Vt {
218- avt:: Vt :: builder ( ) . size ( cols, rows) . resizable ( true ) . build ( )
227+ avt:: Vt :: builder ( ) . size ( cols, rows) . build ( )
219228}
220229
221230fn resize_vt ( vt : & mut avt:: Vt , cols : usize , rows : usize ) {
0 commit comments