From f99715d8805a18dc7c16f17275a85a0724e01db9 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 13 Jul 2023 15:22:14 +0530 Subject: add field names to tree, if any --- tree-viz/src/app.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tree-viz/src/app.rs') diff --git a/tree-viz/src/app.rs b/tree-viz/src/app.rs index 68d3641..8581084 100644 --- a/tree-viz/src/app.rs +++ b/tree-viz/src/app.rs @@ -105,6 +105,23 @@ impl App { ) .unwrap(); + if self.config.show_field_name { + if let Some(f) = cursor.field_name() { + write!( + tree_string, + "{} ", + if in_capture.is_some() { + Style::new().on_yellow().on_bright() + } else { + Style::new() + } + .yellow() + .apply_to(f) + ) + .unwrap() + } + } + write!( tree_string, "{} ", -- cgit v1.2.3