mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
fix(cli): resolve paste issue on Windows terminals. (#15932)
This commit is contained in:
committed by
GitHub
parent
fd7b6bf40a
commit
8f0324d868
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import {
|
||||
disableBracketedPaste,
|
||||
enableBracketedPaste,
|
||||
} from '../utils/bracketedPaste.js';
|
||||
|
||||
/**
|
||||
* Enables and disables bracketed paste mode in the terminal.
|
||||
*
|
||||
* This hook ensures that bracketed paste mode is enabled when the component
|
||||
* mounts and disabled when it unmounts or when the process exits.
|
||||
*/
|
||||
export const useBracketedPaste = () => {
|
||||
const cleanup = () => {
|
||||
disableBracketedPaste();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
enableBracketedPaste();
|
||||
|
||||
process.on('exit', cleanup);
|
||||
process.on('SIGINT', cleanup);
|
||||
process.on('SIGTERM', cleanup);
|
||||
|
||||
return () => {
|
||||
cleanup();
|
||||
process.removeListener('exit', cleanup);
|
||||
process.removeListener('SIGINT', cleanup);
|
||||
process.removeListener('SIGTERM', cleanup);
|
||||
};
|
||||
}, []);
|
||||
};
|
||||
Reference in New Issue
Block a user