mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-18 10:01:29 -07:00
Simplify paste handling (#16654)
This commit is contained in:
committed by
GitHub
parent
41369f67eb
commit
94d5ae541e
@@ -155,7 +155,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
|
||||
expect(mockBuffer.handleInput).toHaveBeenCalledWith({
|
||||
@@ -164,7 +163,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
expect(mockBuffer.text).toBe('a');
|
||||
});
|
||||
@@ -182,7 +180,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
|
||||
expect(mockBuffer.handleInput).toHaveBeenCalledWith({
|
||||
@@ -191,7 +188,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
expect(mockBuffer.text).toBe('tes');
|
||||
});
|
||||
@@ -209,7 +205,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
|
||||
// Cursor moves from end to before 't'
|
||||
@@ -230,7 +225,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
|
||||
expect(mockBuffer.visualCursor[1]).toBe(3);
|
||||
@@ -249,7 +243,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
|
||||
expect(onSubmit).toHaveBeenCalledWith('test');
|
||||
@@ -268,7 +261,6 @@ describe('TextInput', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
});
|
||||
await vi.runAllTimersAsync();
|
||||
|
||||
|
||||
@@ -1051,7 +1051,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: 'h',
|
||||
}),
|
||||
@@ -1062,7 +1061,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: 'i',
|
||||
}),
|
||||
@@ -1080,7 +1078,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: '\r',
|
||||
}),
|
||||
@@ -1098,7 +1095,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\t',
|
||||
}),
|
||||
@@ -1116,7 +1112,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: true,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\u001b[9;2u',
|
||||
}),
|
||||
@@ -1139,7 +1134,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x7f',
|
||||
}),
|
||||
@@ -1164,7 +1158,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x7f',
|
||||
});
|
||||
@@ -1173,7 +1166,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x7f',
|
||||
});
|
||||
@@ -1182,7 +1174,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x7f',
|
||||
});
|
||||
@@ -1242,7 +1233,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x1b[D',
|
||||
}),
|
||||
@@ -1254,7 +1244,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\x1b[C',
|
||||
}),
|
||||
@@ -1274,7 +1263,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: textWithAnsi,
|
||||
}),
|
||||
@@ -1292,7 +1280,6 @@ describe('useTextBuffer', () => {
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: true,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: '\r',
|
||||
}),
|
||||
@@ -1497,7 +1484,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence,
|
||||
});
|
||||
@@ -1556,7 +1542,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: largeTextWithUnsafe,
|
||||
}),
|
||||
@@ -1591,7 +1576,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: largeTextWithAnsi,
|
||||
}),
|
||||
@@ -1616,7 +1600,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: emojis,
|
||||
}),
|
||||
@@ -1808,7 +1791,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: true,
|
||||
sequence: '\r',
|
||||
}),
|
||||
@@ -1830,7 +1812,6 @@ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift: false,
|
||||
paste: false,
|
||||
insertable: false,
|
||||
sequence: '\u001bOP',
|
||||
}),
|
||||
|
||||
@@ -2223,10 +2223,10 @@ export function useTextBuffer({
|
||||
(key: Key): void => {
|
||||
const { sequence: input } = key;
|
||||
|
||||
if (key.paste) {
|
||||
if (key.name === 'paste') {
|
||||
// Do not do any other processing on pastes so ensure we handle them
|
||||
// before all other cases.
|
||||
insert(input, { paste: key.paste });
|
||||
insert(input, { paste: true });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2253,7 +2253,7 @@ export function useTextBuffer({
|
||||
else if (keyMatchers[Command.UNDO](key)) undo();
|
||||
else if (keyMatchers[Command.REDO](key)) redo();
|
||||
else if (key.insertable) {
|
||||
insert(input, { paste: key.paste });
|
||||
insert(input, { paste: false });
|
||||
}
|
||||
},
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user