Add more refinements to the keymap edit UI (#33847)

Quick follow-up to https://github.com/zed-industries/zed/pull/33816,
tidying it up some things a bit more.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-07-03 09:39:03 -03:00 committed by GitHub
parent a6ee4a18c4
commit 2bf2c5c580
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 59 additions and 57 deletions

View file

@ -2,9 +2,9 @@ use std::{ops::Range, rc::Rc, time::Duration};
use editor::{EditorSettings, ShowScrollbar, scroll::ScrollbarAutoHide};
use gpui::{
AppContext, Axis, Context, Entity, FocusHandle, FontWeight, Length,
ListHorizontalSizingBehavior, ListSizingBehavior, MouseButton, Task, UniformListScrollHandle,
WeakEntity, transparent_black, uniform_list,
AppContext, Axis, Context, Entity, FocusHandle, Length, ListHorizontalSizingBehavior,
ListSizingBehavior, MouseButton, Task, UniformListScrollHandle, WeakEntity, transparent_black,
uniform_list,
};
use settings::Settings as _;
use ui::{
@ -12,7 +12,8 @@ use ui::{
ComponentScope, Div, ElementId, FixedWidth as _, FluentBuilder as _, Indicator,
InteractiveElement as _, IntoElement, ParentElement, Pixels, RegisterComponent, RenderOnce,
Scrollbar, ScrollbarState, StatefulInteractiveElement as _, Styled, StyledExt as _,
StyledTypography, Window, div, example_group_with_title, h_flex, px, single_example, v_flex,
StyledTypography, Tooltip, Window, div, example_group_with_title, h_flex, px, single_example,
v_flex,
};
struct UniformListData<const COLS: usize> {
@ -471,11 +472,10 @@ pub fn render_row<const COLS: usize>(
.map_or([None; COLS], |widths| widths.map(Some));
let row = div().w_full().child(
div()
h_flex()
.id("table_row")
.tooltip(Tooltip::text("Hit enter to edit"))
.w_full()
.flex()
.flex_row()
.items_center()
.justify_between()
.px_1p5()
.py_1()
@ -518,11 +518,12 @@ pub fn render_header<const COLS: usize>(
.p_2()
.border_b_1()
.border_color(cx.theme().colors().border)
.children(headers.into_iter().zip(column_widths).map(|(h, width)| {
base_cell_style(width, cx)
.font_weight(FontWeight::SEMIBOLD)
.child(h)
}))
.children(
headers
.into_iter()
.zip(column_widths)
.map(|(h, width)| base_cell_style(width, cx).child(h)),
)
}
#[derive(Clone)]