Răsfoiți Sursa

dnetview/ view: fixed bug wherein list had empty spaces

lunar-mining 4 ani în urmă
părinte
comite
e6b88ec99a
1 a modificat fișierele cu 8 adăugiri și 3 ștergeri
  1. 8 3
      bin/dnetview/src/view.rs

+ 8 - 3
bin/dnetview/src/view.rs

@@ -84,28 +84,30 @@ impl View {
                     let names = ListItem::new(lines);
                     let names = ListItem::new(lines);
                     nodes.push(names);
                     nodes.push(names);
                     for connection in &session.children {
                     for connection in &session.children {
-                        let mut lines: Vec<Spans> = Vec::new();
+                        let mut info = Vec::new();
                         let name = Span::styled(format!("        {}", connection.addr), style);
                         let name = Span::styled(format!("        {}", connection.addr), style);
+                        info.push(name);
                         match connection.last_status.as_str() {
                         match connection.last_status.as_str() {
                             "recv" => {
                             "recv" => {
                                 let msg = Span::styled(
                                 let msg = Span::styled(
                                     format!("                    [R: {}]", connection.last_msg),
                                     format!("                    [R: {}]", connection.last_msg),
                                     style,
                                     style,
                                 );
                                 );
-                                lines.push(Spans::from(vec![name, msg]));
+                                info.push(msg);
                             }
                             }
                             "sent" => {
                             "sent" => {
                                 let msg = Span::styled(
                                 let msg = Span::styled(
                                     format!("                    [S: {}]", connection.last_msg),
                                     format!("                    [S: {}]", connection.last_msg),
                                     style,
                                     style,
                                 );
                                 );
-                                lines.push(Spans::from(vec![name, msg]));
+                                info.push(msg);
                             }
                             }
                             _ => {
                             _ => {
                                 // TODO
                                 // TODO
                             }
                             }
                         }
                         }
 
 
+                        let lines = vec![Spans::from(info)];
                         let names = ListItem::new(lines);
                         let names = ListItem::new(lines);
                         nodes.push(names);
                         nodes.push(names);
                     }
                     }
@@ -119,6 +121,9 @@ impl View {
             .constraints(list_cnstrnts)
             .constraints(list_cnstrnts)
             .split(f.size());
             .split(f.size());
 
 
+        debug!("NODE INFO LENGTH {:?}", nodes.len());
+        debug!("ACTIVE IDS LENGTH {:?}", self.active_ids.ids.len());
+
         let nodes =
         let nodes =
             List::new(nodes).block(Block::default().borders(Borders::ALL)).highlight_symbol(">> ");
             List::new(nodes).block(Block::default().borders(Borders::ALL)).highlight_symbol(">> ");