diff options
| author | blasty <blasty@local> | 2026-07-10 12:23:52 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-10 12:23:52 +0200 |
| commit | 4fd71ed6202c4c9925963c9e9156d3cb0e549b35 (patch) | |
| tree | 5b3ee0dd36224cb82fcb0201aee75e2e57fc61fd /tests | |
| parent | struct editor: discoverable, confirmed delete (d/Del + ConfirmScreen) (diff) | |
| download | ida-tui-4fd71ed6202c4c9925963c9e9156d3cb0e549b35.tar.gz ida-tui-4fd71ed6202c4c9925963c9e9156d3cb0e549b35.tar.xz ida-tui-4fd71ed6202c4c9925963c9e9156d3cb0e549b35.zip | |
clipboard: keyboard copy (OSC 52 + tmux) since mouse-select is captured
The app captures the mouse (SGR tracking), so terminal/tmux drag-select can't
grab text. Add explicit copy actions:
- code views: 'y' copies the current line
- struct editor: Ctrl+Y copies the selection, else the whole C definition
App._copy() emits OSC 52 (Textual copy_to_clipboard) AND, inside tmux, pipes
through 'tmux load-buffer -w -' — the combination is what actually reaches the
system clipboard over tmux/ssh. Status shows the char count.
full suite 87/87.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_tui.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_tui.py b/tests/test_tui.py index 90c882b..6384ec6 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -163,6 +163,14 @@ async def run(db): await wait_until(pilot, lambda: tname in ta.text and "{" in ta.text, 15) check("selecting a struct shows its C definition", tname in ta.text and "{" in ta.text, f"text={ta.text[:40]!r}") + # Ctrl+Y copies the whole definition to the clipboard (OSC 52 + tmux). + app._clipboard = "" + se.query_one(TextArea).focus() + await pilot.press("ctrl+y") + await wait_until(pilot, lambda: app._clipboard == ta.text, 10) + check("Ctrl+Y copies the struct definition to the clipboard", + bool(app._clipboard) and app._clipboard == ta.text, + f"clip_len={len(app._clipboard)}") # create (fixed name so re-runs update in place -> no churn) sname = "TuiEdTest" await pilot.press("ctrl+n") @@ -260,6 +268,15 @@ async def run(db): view.model.cached_line(view.cursor) is not None) check("status shows an address", "@ 0x" in str(status.render()), str(status.render())) + # 'y' copies the current code line to the clipboard. + view.focus() + cur_line = view._line_plain(view.cursor) + app._clipboard = "" + await pilot.press("y") + await wait_until(pilot, lambda: app._clipboard == cur_line, 10) + check("'y' copies the current code line to the clipboard", + bool(cur_line) and app._clipboard == cur_line, f"clip={app._clipboard!r}") + # Jump to bottom of a (possibly huge) function; must not hang. await pilot.press("end") await pilot.pause(0.05) |
