Commit 3c4b1a7
authored
fix: paste not working in PTY sessions (#89)
* fix: Enable paste operations in PTY mode sessions
Resolves clipboard paste issues in PTY SSH sessions by implementing
bracketed paste mode support and handling Event::Paste events.
Changes:
- Enable bracketed paste mode in TerminalStateGuard::new()
- Disable bracketed paste mode in restore_terminal_state()
- Add Event::Paste handler in handle_input_event()
- Increase SmallVec capacity from 8 to 64 bytes for paste content
- Update PtyMessage::LocalInput to use SmallVec<[u8; 64]>
- Add comprehensive unit tests for paste event handling
This fixes paste operations on all platforms (macOS Cmd+V, Linux
Ctrl+Shift+V, Windows Ctrl+V) by properly capturing and forwarding
pasted content through the SSH channel.
Tests: All 455 tests pass, including 8 new paste event tests
* fix: Add paste size limit and optimize memory handling
- Add 1MB size limit to prevent memory exhaustion attacks (H1 issue)
- Return None for empty paste to avoid unnecessary channel sends (M1 issue)
- Use from_vec() instead of into_bytes() + from_slice() to avoid double copy (L1 issue)
- Add test for paste size limit behavior
* style: Apply cargo fmt formatting to test assertions
* test: Add comprehensive tests for key input handling
- Add tests for all Ctrl+key combinations (C, D, Z, A, E, U, K, W, L, R, B, F)
- Add tests for arrow keys (Up, Down, Left, Right)
- Add tests for all function keys (F1-F12) and verify F13+ returns None
- Add tests for special keys (Enter, Tab, Backspace, Esc, Home, End, PageUp, PageDown, Insert, Delete)
- Add tests for KeyEventKind::Release and Repeat being ignored
- Add tests for modifier keys (Shift accepted, Alt/Meta ignored for chars)
- Add tests for Unicode and emoji character input
- Add test for mouse events returning None
- Add test for Ctrl+char out of range1 parent cb84ad5 commit 3c4b1a7
3 files changed
Lines changed: 909 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
0 commit comments