mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-09 12:51:09 -07:00
Restore bracketed paste mode after external editor exit (#13606)
This commit is contained in:
committed by
GitHub
parent
9f9a2fa844
commit
1e715d1e5c
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { writeToStdout } from '@google/gemini-cli-core';
|
||||
|
||||
const ENABLE_BRACKETED_PASTE = '\x1b[?2004h';
|
||||
const DISABLE_BRACKETED_PASTE = '\x1b[?2004l';
|
||||
import {
|
||||
disableBracketedPaste,
|
||||
enableBracketedPaste,
|
||||
} from '../utils/bracketedPaste.js';
|
||||
|
||||
/**
|
||||
* Enables and disables bracketed paste mode in the terminal.
|
||||
@@ -18,11 +18,11 @@ const DISABLE_BRACKETED_PASTE = '\x1b[?2004l';
|
||||
*/
|
||||
export const useBracketedPaste = () => {
|
||||
const cleanup = () => {
|
||||
writeToStdout(DISABLE_BRACKETED_PASTE);
|
||||
disableBracketedPaste();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
writeToStdout(ENABLE_BRACKETED_PASTE);
|
||||
enableBracketedPaste();
|
||||
|
||||
process.on('exit', cleanup);
|
||||
process.on('SIGINT', cleanup);
|
||||
|
||||
Reference in New Issue
Block a user