mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-16 11:19:33 +01:00
fix: strip nested paste markers until none is left (release review, #726)
Ctrl+V's hand-built bracketed paste (#726) and the phone composer's dropped CSI 200~/201~ markers from the text in ONE pass, so a clipboard carrying ESC[20 ESC[201~ 1~ came out of it with an ESC[201~ that ended the frame early: everything after it was typed as keys and each CR ran. Both now strip until nothing matches. The composer's copy predates this release; it is the same one-liner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ad9db7606
commit
9f7cba07ab
4 files changed
+29
-3
No files matched your search
@@ -259,6 +259,15 @@ describe('Ctrl+V paste trap', () => {
|
||||
expect(h.sentInputs).toEqual([]);
|
||||
});
|
||||
|
||||
it('strips a marker hidden inside another, so the clipboard cannot end the frame early', () => {
|
||||
const h = loadPasteHarness();
|
||||
|
||||
// One pass over this leaves `ESC[201~` between `ok` and the command.
|
||||
h.firePaste({ text: 'ok\x1b[20\x1b[201~1~\nrm -rf ~/x\n' });
|
||||
|
||||
expect(h.inputted).toEqual(['\x1b[200~ok\rrm -rf ~/x\r\x1b[201~']);
|
||||
});
|
||||
|
||||
it('addresses the bracketed paste to the pane that received Ctrl+V', () => {
|
||||
const paneInputs: string[] = [];
|
||||
const pane: TargetTerminal = {
|
||||
|
||||
@@ -725,6 +725,16 @@ describe('mobile shell Paste', () => {
|
||||
expect(app._sendInputAsync).toHaveBeenCalledWith('session-1', '\x1b[200~echo safe\rrm -rf ~/x\x1b[201~');
|
||||
});
|
||||
|
||||
it('drops a paste marker hidden inside another one', () => {
|
||||
const { app, input, send } = openShellPaste();
|
||||
// One pass over this leaves `ESC[201~` between `ok` and the command.
|
||||
input.value = 'ok\x1b[20\x1b[201~1~\nrm -rf ~/x';
|
||||
|
||||
send.click();
|
||||
|
||||
expect(app._sendInputAsync).toHaveBeenCalledWith('session-1', '\x1b[200~ok\rrm -rf ~/x\x1b[201~');
|
||||
});
|
||||
|
||||
it('refuses a paste longer than one input frame and keeps the text for trimming', () => {
|
||||
const { app, bar, document, input, send } = openShellPaste();
|
||||
input.value = 'x'.repeat(bar._composerMaxLength + 1);
|
||||
|
||||
Reference in new issue
Block a user