Repository navigation
fix(client): show IME and dictation composition at the cursor - #45
Merged
Merged
Conversation
Keep focus on ghostty-web's input textarea, anchor it at the cursor cell, and draw the composition over the cursor in the theme's font and colours, instead of as a stray line under the canvas. See ADR 038.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
macOS dictation (and IME input) showed its in-progress text as a new line under the terminal, in the browser's default colours, pushing the whole UI up until the composition ended.
ghostty-web makes the terminal container
contenteditable. When the container holds focus (a click in the padding or edge strip, tab focus,term.focus()), the browser writes the composition into it as a text node after the canvas. When ghostty-web's hidden textarea holds focus, the composition is invisible and the OS panels anchor to the textarea's spot at the top-left corner.This PR adds
src/client/compose.ts, which:focusin, and on windowfocuswhen the container still holds it.foregroundonbackground, underlined. It hides oncompositionendor blur.Committed text still reaches the PTY through ghostty-web's own
compositionendpath. The upstream issue is coder/ghostty-web#97, and coder/ghostty-web#190 fixes the same causes. Once a ghostty-web release includes that fix, this layer can be removed.Verification
bun run build && bun run webtty stopbun test(434 passed, including the newcompose.test.ts)bun run lintcompositionendthe text reaches the shell and the overlay hides.ADRs