mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Make PASTE_WORKAROUND the default. (#12008)
This commit is contained in:
committed by
GitHub
parent
ce26b58f09
commit
ef70e63230
@@ -752,7 +752,7 @@ describe('InputPrompt', () => {
|
||||
await wait();
|
||||
|
||||
stdin.write('\x03'); // Ctrl+C character
|
||||
await wait();
|
||||
await wait(60);
|
||||
|
||||
expect(props.buffer.setText).toHaveBeenCalledWith('');
|
||||
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
|
||||
@@ -766,7 +766,7 @@ describe('InputPrompt', () => {
|
||||
await wait();
|
||||
|
||||
stdin.write('\x03'); // Ctrl+C character
|
||||
await wait();
|
||||
await wait(60);
|
||||
|
||||
expect(props.buffer.setText).not.toHaveBeenCalled();
|
||||
unmount();
|
||||
@@ -940,7 +940,7 @@ describe('InputPrompt', () => {
|
||||
await wait();
|
||||
|
||||
stdin.write('\x1B[200~pasted text\x1B[201~');
|
||||
await wait();
|
||||
await wait(60);
|
||||
|
||||
expect(mockBuffer.handleInput).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -1331,7 +1331,7 @@ describe('InputPrompt', () => {
|
||||
await wait();
|
||||
|
||||
stdin.write('\x1B');
|
||||
await wait(100);
|
||||
await wait(60);
|
||||
|
||||
expect(props.buffer.setText).toHaveBeenCalledWith('');
|
||||
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
|
||||
@@ -1392,7 +1392,7 @@ describe('InputPrompt', () => {
|
||||
await wait();
|
||||
|
||||
stdin.write('\x1B');
|
||||
await wait(100);
|
||||
await wait(60);
|
||||
|
||||
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
|
||||
unmount();
|
||||
|
||||
@@ -1348,7 +1348,7 @@ describe('SettingsDialog', () => {
|
||||
|
||||
// Press Escape to exit
|
||||
stdin.write('\u001B');
|
||||
await wait(100);
|
||||
await wait(60);
|
||||
|
||||
expect(onSelect).toHaveBeenCalledWith(undefined, 'User');
|
||||
|
||||
|
||||
@@ -481,19 +481,8 @@ export function useKeypressContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the passthrough stream workaround should be used.
|
||||
* This is necessary for Node.js versions older than 20 or when the
|
||||
* PASTE_WORKAROUND environment variable is set, to correctly handle
|
||||
* paste events.
|
||||
*/
|
||||
function shouldUsePassthrough(): boolean {
|
||||
const nodeMajorVersion = parseInt(process.versions.node.split('.')[0], 10);
|
||||
return (
|
||||
nodeMajorVersion < 20 ||
|
||||
process.env['PASTE_WORKAROUND'] === '1' ||
|
||||
process.env['PASTE_WORKAROUND'] === 'true'
|
||||
);
|
||||
return process.env['PASTE_WORKAROUND'] !== 'false';
|
||||
}
|
||||
|
||||
export function KeypressProvider({
|
||||
|
||||
@@ -66,13 +66,6 @@ describe('useKeypress', () => {
|
||||
});
|
||||
});
|
||||
|
||||
const setNodeVersion = (version: string) => {
|
||||
Object.defineProperty(process.versions, 'node', {
|
||||
value: version,
|
||||
configurable: true,
|
||||
});
|
||||
};
|
||||
|
||||
it('should not listen if isActive is false', () => {
|
||||
renderHook(() => useKeypress(onKeypress, { isActive: false }), {
|
||||
wrapper,
|
||||
@@ -124,19 +117,12 @@ describe('useKeypress', () => {
|
||||
|
||||
describe.each([
|
||||
{
|
||||
description: 'Modern Node (>= v20)',
|
||||
setup: () => setNodeVersion('20.0.0'),
|
||||
description: 'PASTE_WORKAROUND true',
|
||||
setup: () => vi.stubEnv('PASTE_WORKAROUND', 'true'),
|
||||
},
|
||||
{
|
||||
description: 'Legacy Node (< v20)',
|
||||
setup: () => setNodeVersion('18.0.0'),
|
||||
},
|
||||
{
|
||||
description: 'Workaround Env Var',
|
||||
setup: () => {
|
||||
setNodeVersion('20.0.0');
|
||||
vi.stubEnv('PASTE_WORKAROUND', 'true');
|
||||
},
|
||||
description: 'PASTE_WORKAROUND false',
|
||||
setup: () => vi.stubEnv('PASTE_WORKAROUND', 'false'),
|
||||
},
|
||||
])('in $description', ({ setup }) => {
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user