mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-18 18:11:02 -07:00
Add setting to support OSC 52 paste (#15336)
This commit is contained in:
committed by
GitHub
parent
2cb33b2f76
commit
384fb6a465
@@ -4,7 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { renderWithProviders } from '../../test-utils/render.js';
|
||||
import {
|
||||
renderWithProviders,
|
||||
createMockSettings,
|
||||
} from '../../test-utils/render.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { act } from 'react';
|
||||
import type { InputPromptProps } from './InputPrompt.js';
|
||||
@@ -598,7 +601,7 @@ describe('InputPrompt', () => {
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(debugLoggerErrorSpy).toHaveBeenCalledWith(
|
||||
'Error handling clipboard image:',
|
||||
'Error handling paste:',
|
||||
expect.any(Error),
|
||||
);
|
||||
});
|
||||
@@ -633,6 +636,31 @@ describe('InputPrompt', () => {
|
||||
});
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('should use OSC 52 when useOSC52Paste setting is enabled', async () => {
|
||||
vi.mocked(clipboardUtils.clipboardHasImage).mockResolvedValue(false);
|
||||
const settings = createMockSettings({
|
||||
experimental: { useOSC52Paste: true },
|
||||
});
|
||||
|
||||
const { stdout, stdin, unmount } = renderWithProviders(
|
||||
<InputPrompt {...props} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
const writeSpy = vi.spyOn(stdout, 'write');
|
||||
|
||||
await act(async () => {
|
||||
stdin.write('\x16'); // Ctrl+V
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(writeSpy).toHaveBeenCalledWith('\x1b]52;c;?\x07');
|
||||
});
|
||||
// Should NOT call clipboardy.read()
|
||||
expect(clipboardy.read).not.toHaveBeenCalled();
|
||||
unmount();
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
|
||||
Reference in New Issue
Block a user