input: allow Editor as the control of an InputGroup
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read crates/component/src/input/group.rs around InputGroupControl conversions and compare the Textarea path in crates/component/src/input/textarea.rs with how Editor exposes its state and options. Add an Editor conversion that preserves its options, then check that an Editor can be passed to InputGroup::input while retaining the group's frame and addons.
Written by the indexing model from the issue text.
Description
Description
InputGroup::input accepts only Input and Textarea, so an Editor cannot be framed by an InputGroup with addons. A chat-style composer whose body needs syntax highlighting therefore cannot reuse the group's frame, footer addons and focus treatment.
Internally, almost everything needed is already in place:
InputGroupControlwraps anInput(group.rs#L460-L473), withFrom<Input>andFrom<Textarea>only.Textareaconverts through the crate-privateTextarea::into_input(textarea.rs#L185-L195).Input::from_stateispub(crate). Its doc comment saysTextareaandEditorboth render through it.TextInputStatealready has anEditor(Entity<EditorState>)variant (state.rs#L37-L41).
So the missing piece is an Editor → InputGroupControl conversion.
main still has only the Input and Textarea conversions.
Environment
- GPUI: gpui-pre 0.3.9
- GPUI Component: gpui-kit 0.8.0
- Platform: macOS 27 (arm64)
Steps to Reproduce
let state = cx.new(|cx| EditorState::new(window, cx).language("bash"));
InputGroup::new("shell-composer")
.input(Editor::new(&state)) // error: `From<Editor>` is not implemented for `InputGroupControl`
.addon(InputGroupAddon::new("footer").align(InputGroupAddonAlignment::BlockEnd).child(footer));
Expected
An Editor can be the control of an InputGroup, just like Textarea. The group provides the frame, border, focus ring and addons, and the editor keeps its language, highlighting, soft wrap, submit_on_enter and other options.
Actual
It does not compile. The alternatives are drawing a separate frame that has to track the group's styling by hand, or placing a dummy Input in the group.
Suggested change
- Add
impl From<Editor> for InputGroupControl, mirroring theTextareapath (e.g. anEditor::into_inputthat carries the editor's options). - Optional: give
Editoran auto-grow option likeTextarea::auto_grow(min, max). When an editor is used as a composer body, it currently has to compute its own height from the display map.
Context: Gupi is adding a dedicated shell-command composer with Bash highlighting next to its normal message composer. For now it draws its own frame with the theme's input tokens.
- Dominant language
- Rust
- Stars
- 18.2k
- Forks
- 1.1k
- Avg merge
- 14h 15m
- Merged PRs (30d)
- 312
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from longbridge/gpui-kit
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
longbridge/gpui-kit#3612 ·
Maintainers usually reply within 1 day
-
editor input windows
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
longbridge/gpui-kit#2877 · 2 comments ·
Maintainers usually reply within 1 day
-
sidebar
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
longbridge/gpui-kit#1818 · 3 comments ·
Maintainers usually reply within 1 day
-
resizable: drag is dropped when move/up events arrive before the next paintPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 74/100
longbridge/gpui-kit#3619 ·
Maintainers usually reply within 1 day
-
input
Difficulty 5/5 Over a week Newbie friendliness 25/100
longbridge/gpui-kit#3605 · 1 comment ·
Maintainers usually reply within 1 day
All issues in longbridge/gpui-kit
Similar issues
-
C-bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
rust-lang/rust-analyzer#23547 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenZeppelin/guardian#570 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
documentation priority:p2 type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
facebookincubator/scrut#60 ·