Add public API for sending input to the terminal (#126)#128
Merged
Conversation
Promote two thin wrappers — `ghostel-send-string' and `ghostel-send-key' — so external packages (agent integrations, custom keymaps) can drive a ghostel buffer without reaching into `ghostel--' internals. Both signal a `user-error' when called outside a ghostel-mode buffer. Rename the internal `ghostel--send-key' to `ghostel--send-string' to match what it does (writes raw bytes to the PTY) and avoid naming confusion with the new public `ghostel-send-key' (which takes a key name and mods and goes through the encoder). The old internal name is kept as an obsolete alias so third-party packages that reached into it keep working.
0f838c4 to
5453c22
Compare
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.
Closes #126.
Summary
Adds two thin public wrappers so external packages (agent integrations, Swerty-style keymaps, etc.) can drive a ghostel buffer without poking at
ghostel--internals:ghostel-send-string STRING— forwards toghostel--send-keyghostel-send-key KEY-NAME &optional MODS— forwards toghostel--send-encodedBoth operate on the current buffer and signal
user-errorwhen called outside aghostel-modebuffer (same predicate style asghostel-debug-typing-latency). The internals stay as-is — nothing is renamed, no behavior changes for existing callers.The
utf8third arg ofghostel--send-encodedis intentionally not exposed (no caller uses it; the VT derives text from the key name).Test plan
make -j4 all test-evil— 123 elisp + 74 native + 30 evil tests passuser-errorwhen called outside a ghostel buffer(with-current-buffer "*ghostel*" (ghostel-send-string "echo hi\n"))