diff options
Diffstat (limited to 'zellij-tile/src/ui_components/table.rs')
-rw-r--r-- | zellij-tile/src/ui_components/table.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/zellij-tile/src/ui_components/table.rs b/zellij-tile/src/ui_components/table.rs index df1b833bf..5ef07d7a3 100644 --- a/zellij-tile/src/ui_components/table.rs +++ b/zellij-tile/src/ui_components/table.rs @@ -59,3 +59,26 @@ pub fn print_table_with_coordinates( table.serialize() ) } + +pub fn serialize_table(table: &Table) -> String { + format!("\u{1b}Pztable;{}", table.serialize()) +} + +pub fn serialize_table_with_coordinates( + table: &Table, + x: usize, + y: usize, + width: Option<usize>, + height: Option<usize>, +) -> String { + let width = width.map(|w| w.to_string()).unwrap_or_default(); + let height = height.map(|h| h.to_string()).unwrap_or_default(); + format!( + "\u{1b}Pztable;{}/{}/{}/{};{}\u{1b}\\", + x, + y, + width, + height, + table.serialize() + ) +} |