Skip to content

Commit 3c85ccb

Browse files
authored
number_input: Fix NumberInput appearance by #858 change. (#860)
1 parent bc398ad commit 3c85ccb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/ui/src/input/number_input.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use gpui::{
2-
actions, prelude::FluentBuilder as _, px, App, Context, Entity, EventEmitter, FocusHandle,
3-
Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement, RenderOnce,
2+
actions, prelude::FluentBuilder as _, px, App, Context, ElementId, Entity, EventEmitter,
3+
FocusHandle, Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement, RenderOnce,
44
SharedString, Styled, Window,
55
};
66

@@ -26,6 +26,7 @@ pub fn init(cx: &mut App) {
2626

2727
#[derive(IntoElement)]
2828
pub struct NumberInput {
29+
id: ElementId,
2930
state: Entity<InputState>,
3031
placeholder: SharedString,
3132
size: Size,
@@ -35,6 +36,7 @@ impl NumberInput {
3536
/// Create a new [`NumberInput`] element bind to the [`InputState`].
3637
pub fn new(state: &Entity<InputState>) -> Self {
3738
Self {
39+
id: ("number-input", state.entity_id()).into(),
3840
state: state.clone(),
3941
size: Size::default(),
4042
placeholder: SharedString::default(),
@@ -115,6 +117,7 @@ impl RenderOnce for NumberInput {
115117
};
116118

117119
h_flex()
120+
.id(self.id)
118121
.key_context(KEY_CONTENT)
119122
.on_action(window.listener_for(&self.state, InputState::on_action_increment))
120123
.on_action(window.listener_for(&self.state, InputState::on_action_decrement))
@@ -142,7 +145,7 @@ impl RenderOnce for NumberInput {
142145
}
143146
}),
144147
)
145-
.child(TextInput::new(&self.state).no_gap())
148+
.child(TextInput::new(&self.state).appearance(false).no_gap())
146149
.child(
147150
Button::new("plus")
148151
.ghost()

0 commit comments

Comments
 (0)