Text Scope and Accepted Paragraphs
How UnimeType chooses request text, preserves structure, and handles words appended after conversion.
UnimeType keeps three objects separate:
- Captured text: text read from the host or local typing buffer.
- Request text: the captured body after local protection is applied.
- Replacement text: preserved prefix + model output + preserved suffix.
Capture order
Convert
- Use the non-empty selection. Convert excludes outer whitespace from its request and replacement range but keeps selected structural markers.
- In Terminal, Ghostty, VS Code, or VS Code Insiders, use the current local typing buffer when it is available and the caret is collapsed.
- Otherwise read the complete paragraph containing the caret.
- If paragraph access is empty or unavailable, use the current typing buffer.
- If no source is available, report Nothing to convert.
Polish and Explain
- Use the exact non-empty selection, including its outer whitespace.
- Otherwise capture the sentence around the caret. Sentence delimiters are
。!?.!?and newline. - If sentence access is unavailable, use the current typing buffer.
Paragraph and structure boundaries
A hard newline defines a paragraph boundary. Soft visual wrapping does not. The boundary newline is never part of the automatic replacement range.
For automatic Convert capture, UnimeType preserves outer whitespace and removes these structural prefixes from the request body:
- Markdown headings such as
## - Block quotes such as
> - Ordered and unordered list markers
- Task boxes such as
[ ]and[x]
Convert narrows an explicit selection only to exclude outer whitespace; it does not strip the selection's structural prefix. Polish and Explain keep their explicit selection exact, including outer whitespace and prefixes.
Accepted paragraphs and appended words
After a verified paragraph conversion, UnimeType remembers the resulting text, its starting range, and the host client. If the same paragraph still begins with that accepted text and the user appends more words, the next Convert sends only the new suffix. Up to 100 preceding characters from the accepted prefix are included as read-only context.
If the current paragraph no longer begins with the accepted text, UnimeType sends the complete paragraph body again. When only the newly typed suffix can be verified in the local buffer, replacement deletes and replaces only that suffix, leaving the accepted prefix in the host.
Typing-buffer invalidation
The local buffer is cleared by a client change, pointer input outside the action menu, newline, navigation or focus keys, Command/Control editing commands, Option-Backspace, an untrackable key, input-method deactivation, or a completed or unchanged action. Normal Backspace removes its last character.
Immediately before replacement, UnimeType checks that the captured host range or typed-buffer generation is still unchanged. A mismatch reports Text changed and prevents replacement.