summaryrefslogtreecommitdiff
path: root/internal/tmuxedit/send.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-02 09:38:04 +0300
committerPaul Buetow <paul@buetow.org>2026-07-02 09:38:04 +0300
commita68228bfa12f4d8a51fe53e244fcd2e66c1ef692 (patch)
tree94e257b21b93419fef655c9813f68190204c3d0d /internal/tmuxedit/send.go
parent9f0e96ce62339ddefa8771891e0864ede9af5064 (diff)
Remove hexai-tmux-edit popup editor featurev0.42.0
The tmux popup editor and its per-agent detection (Cursor/Amp/Aider) added maintenance surface without enough use to justify it; Codex and Claude Code already support external-editor mode natively via Ctrl+G. Drops internal/tmuxedit, cmd/hexai-tmux-edit, the [tmux_edit] config schema, the Mage build target, and all related docs/README mentions. Bump version to 0.42.0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'internal/tmuxedit/send.go')
-rw-r--r--internal/tmuxedit/send.go66
1 files changed, 0 insertions, 66 deletions
diff --git a/internal/tmuxedit/send.go b/internal/tmuxedit/send.go
deleted file mode 100644
index 2af7074..0000000
--- a/internal/tmuxedit/send.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package tmuxedit
-
-import (
- "fmt"
- "strconv"
- "strings"
- "time"
-)
-
-func sendKeys(paneID string, keys ...string) error {
- return tmuxEditDeps{}.send(paneID, keys...)
-}
-
-func (d tmuxEditDeps) send(paneID string, keys ...string) error {
- if d.sendKeys != nil {
- return d.sendKeys(paneID, keys...)
- }
- args := append([]string{"send-keys", "-t", paneID}, keys...)
- _, err := d.command("tmux", args...)
- if err != nil {
- return fmt.Errorf("send-keys failed: %w", err)
- }
- return nil
-}
-
-func sendRepeatedKey(paneID, key string, count int) error {
- return tmuxEditDeps{}.sendRepeated(paneID, key, count)
-}
-
-// sendRepeated uses `tmux send-keys -N <count>` for efficient bulk key repeats
-// (e.g. 200 backspaces).
-func (d tmuxEditDeps) sendRepeated(paneID, key string, count int) error {
- if d.sendRepeatedKey != nil {
- return d.sendRepeatedKey(paneID, key, count)
- }
- args := []string{"send-keys", "-t", paneID, "-N", strconv.Itoa(count), key}
- _, err := d.command("tmux", args...)
- if err != nil {
- return fmt.Errorf("send-keys -N failed: %w", err)
- }
- return nil
-}
-
-func sleepAfterClear() { tmuxEditDeps{}.sleep() }
-
-func (d tmuxEditDeps) sleep() {
- if d.sleepAfterClear != nil {
- d.sleepAfterClear()
- return
- }
- time.Sleep(300 * time.Millisecond)
-}
-
-// deduplicateText compares the original (pre-filled) text with what the user
-// returned from the editor. Returns empty string if unchanged (no-op), or
-// the full edited text if anything changed. The caller is responsible for
-// clearing existing pane input before sending the result, so we always return
-// the complete text rather than stripping the original prefix.
-func deduplicateText(original, edited string) string {
- original = strings.TrimSpace(original)
- edited = strings.TrimSpace(edited)
- if edited == "" || edited == original {
- return ""
- }
- return edited
-}