table: Fix render_tr to ensure apply with h_flex. (#810)

- Reduce last empty column to 12px.
This commit is contained in:
Jason Lee 2025-04-23 22:09:14 +08:00 committed by GitHub
parent b4449f10cf
commit 3cff72cc37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ use crate::{
h_flex, h_flex,
popup_menu::PopupMenu, popup_menu::PopupMenu,
scroll::{self, ScrollableMask, Scrollbar, ScrollbarState}, scroll::{self, ScrollableMask, Scrollbar, ScrollbarState},
v_flex, ActiveTheme, Icon, IconName, Sizable, Size, StyleSized as _, v_flex, ActiveTheme, Icon, IconName, Sizable, Size, StyleSized as _, StyledExt,
}; };
use gpui::{ use gpui::{
actions, canvas, div, prelude::FluentBuilder, px, uniform_list, App, AppContext, Axis, Bounds, actions, canvas, div, prelude::FluentBuilder, px, uniform_list, App, AppContext, Axis, Bounds,
@ -344,7 +344,7 @@ pub trait TableDelegate: Sized + 'static {
/// Render the last empty column, default to empty. /// Render the last empty column, default to empty.
fn render_last_empty_col(&mut self, window: &mut Window, cx: &mut Context<Table<Self>>) -> Div { fn render_last_empty_col(&mut self, window: &mut Window, cx: &mut Context<Table<Self>>) -> Div {
h_flex().w_5().h_full().flex_shrink_0() h_flex().w_3().h_full().flex_shrink_0()
} }
/// Called when the visible range of the rows changed. /// Called when the visible range of the rows changed.
@ -1237,6 +1237,7 @@ where
if row_ix < rows_count { if row_ix < rows_count {
self.delegate self.delegate
.render_tr(row_ix, window, cx) .render_tr(row_ix, window, cx)
.h_flex()
.w_full() .w_full()
.h(self.size.table_row_height()) .h(self.size.table_row_height())
.border_b_1() .border_b_1()
@ -1380,6 +1381,7 @@ where
// Render fake rows to fill the rest table space // Render fake rows to fill the rest table space
self.delegate self.delegate
.render_tr(row_ix, window, cx) .render_tr(row_ix, window, cx)
.h_flex()
.w_full() .w_full()
.h_full() .h_full()
.border_t_1() .border_t_1()