From 3fdefac0f55ea67a1d82bf2ab6cf48878a8139bf Mon Sep 17 00:00:00 2001 From: Suyog Tandel Date: Thu, 19 Feb 2026 21:48:08 +0530 Subject: [PATCH] chore(ui): Improve logs view line spacing and set max terminal height --- src/main.rs | 1 + src/ui/colors.rs | 2 ++ src/ui/views/logs.rs | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 680fd76..6e35e80 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,7 @@ fn main() { traffic_light_position: Some(gpui::point(px(12.0), px(12.0))), }), + // Render our own window decorations(shadows and resize attack area) for linux/bsd. #[cfg(any(target_os = "linux", target_os = "freebsd"))] window_background: gpui::WindowBackgroundAppearance::Transparent, #[cfg(any(target_os = "linux", target_os = "freebsd"))] diff --git a/src/ui/colors.rs b/src/ui/colors.rs index 9a38649..1f44991 100644 --- a/src/ui/colors.rs +++ b/src/ui/colors.rs @@ -1,3 +1,5 @@ +// NOTE: This module is work in progress and more colors will be added. Also I am thinking of storing these as HSLA instead of u32 RGB values. +// Reference: https://ui.shadcn.com/colors pub mod zinc { #![allow(unused)] pub const ZINC50: u32 = 0xfafafa; diff --git a/src/ui/views/logs.rs b/src/ui/views/logs.rs index 6b142ac..234f59f 100644 --- a/src/ui/views/logs.rs +++ b/src/ui/views/logs.rs @@ -102,21 +102,33 @@ impl Render for LogsView { .overflow_y_scrollbar() .flex_1() .h(px(500.0)) - .child(div().p_4().font_family("Mono").text_sm().child( - v_flex().gap_0().children(self.logs.iter().map(|log| { - let color = if log.contains("ERROR") { - gpui::red() - } else if log.contains("WARN") { - gpui::yellow() - } else if log.contains("INFO") { - gpui::green() - } else { - theme.foreground - }; + .child( + div() + .overflow_y_scrollbar() + .max_h(px(500.0)) + .p_4() + .font_family("Mono") + .text_sm() + .child(v_flex().gap_neg_4().children( + self.logs.iter().map(|log| { + // TODO: Convert these values to constants in colors.rs + let color = if log.contains("ERROR") { + rgb(0xef4444) + } else if log.contains("WARN") { + rgb(0xfde047) + } else if log.contains("INFO") { + rgb(0x4ade80) + } else { + theme.foreground.to_rgb() + }; - div().text_color(color).child(log.clone()) - })), - )) + div() + .text_color(color) + .child(log.clone()) + .cursor_text() + }), + )), + ) .into_any_element() }), )