`Pane.send_keys` types nothing and raises nothing for text that starts with `-`
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 82/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
閱讀 src/libtmux/pane.py 中第 847 行附近 Pane.send_keys 建構 argv 的部分,並檢查 Pane.cmd 如何處理 tmux 引數。使用提供的 -n hello 輸入重現問題,接著確認它是否到達 pane,或是否引發 tmux 錯誤。當 literal=False 和 literal=True 對以短橫線開頭的文字都如預期運作時,即為完成。
由索引模型根據 Issue 內容生成。
描述
Summary
Pane.send_keys("-n hello") returns normally, yet nothing reaches the pane, with literal=False and with literal=True. tmux rejects the call with unknown flag -n and exit status 1. send_keys passes the text right after its own flags with no --, and does not check the result. Text that starts with - is ordinary in scripted input: command-line flags, Markdown bullets, negative numbers.
Reproduction
- Start a private server with a
shpane and send text that starts with-:
import libtmux
srv = libtmux.Server(socket_name="sendkeys-dash", config_file="/dev/null")
pane = srv.new_session("probe", window_command="sh").active_window.active_pane
pane.send_keys("-n hello", enter=False)
pane.send_keys("-n hello", enter=False, literal=True)
print(repr(pane.capture_pane()[-1]))
srv.kill()
- Send the same text through
Pane.cmdwith--:
proc = pane.cmd("send-keys", "-l", "--", "-n hello")
Expected
The pane shows $ -n hello, or send_keys raises with tmux's error.
Actual
The pane shows '$'. Both calls return without raising. The raw call without -- fails with command send-keys: unknown flag -n; with -- it types the text.
Environment
- libtmux:
masterat886b1cd(v0.62.0 plus 114 commits) - tmux: 3.8 (system build reports 3.8a)
- Python: run with
uv run --frozenfrom the libtmux checkout - OS: Linux (WSL2), private
-Lsocket,-f /dev/null
Evidence
send_keys('-n hello', literal=False): no exception
send_keys('-n hello', literal=True): no exception
pane line after sends: '$'
pane.cmd('send-keys', ('-l', '-n hello')): returncode=1 stderr=['command send-keys: unknown flag -n']
pane.cmd('send-keys', ('-l', '--', '-n hello')): returncode=0 stderr=[]
pane line after raw sends: '$ -n hello'
References
- The call that builds the argv:
src/libtmux/pane.py#L847 - The Go and TypeScript ports put
--before the text:tmux/pane_input.go#L248,pane_io.ts#L30 - Projects that guard this by hand: mitsuhiko/agent-stuff tells agents to send
-l --(SKILL.md#L54); ntm notes a trailing;is eaten even after--(session.go#L1969); UltiSnips escapes by trial (vim_interface.py#L161)
- 主要語言
- Python
- 星號
- 1.2k
- 分支
- 127
- 平均合併
- 2 小時 37 分鐘
- 30 天內合併 PR
- 33
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
tmux-python/libtmux 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 65/100
tmux-python/libtmux#856 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 83/100
tmux-python/libtmux#839 · 1 則留言 ·
維護者通常 1 天內回覆
-
`show_option` coerces user options, so an `@` option set to `123` or `on` comes back as an int or a bool可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
tmux-python/libtmux#759 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
tmux-python/libtmux#745 · 2 則留言 ·
維護者通常 1 天內回覆
-
Documentation: how to use internal libtmux logging可能已有人在做 @tony 於 84 天前認領。 未關閉enhancement
難度 2/5 1-3 小時 新手友好度 72/100
tmux-python/libtmux#744 ·
維護者通常 1 天內回覆
查看 tmux-python/libtmux 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
roman-corgi/corgisim#327 ·
維護者通常 2 天內回覆
-
[Bug]: opencode_go chat route drops reasoning_effort (even 'none'), while the same endpoint honors it via custom_llm_provider=openai可能已有人在做 @arvindkumar-ship-it 今天認領。 未關閉llm translation
難度 2/5 1-3 小時 新手友好度 70/100
BerriAI/litellm#51871 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
PolicyEngine backdates South Carolina’s EITC into 2015–2017可能已有人在做 @MaxGhenis 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
PolicyEngine/policyengine-us#10944 ·
維護者通常 2 天內回覆
-
fix(frontend): resolve SSE parser crash on unhandled Ref methods and undefined actions identifier未關閉bug
難度 2/5 1-3 小時 新手友好度 75/100
kodokbakar/MiroFish-Local#94 ·
維護者通常 1 天內回覆