mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-22 17:26:58 -07:00
feat(core): track shell cursor visibility in output events
This commit is contained in:
@@ -36,6 +36,7 @@ export type ExecutionOutputEvent =
|
||||
| {
|
||||
type: 'data';
|
||||
chunk: string | AnsiOutput;
|
||||
isCursorHidden?: boolean;
|
||||
}
|
||||
| {
|
||||
type: 'binary_detected';
|
||||
|
||||
@@ -299,10 +299,12 @@ describe('ShellExecutionService', () => {
|
||||
expect(result.output.trim()).toBe('file1.txt');
|
||||
expect(handle.pid).toBe(12345);
|
||||
|
||||
expect(onOutputEventMock).toHaveBeenCalledWith({
|
||||
type: 'data',
|
||||
chunk: createExpectedAnsiOutput('file1.txt'),
|
||||
});
|
||||
expect(onOutputEventMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: 'data',
|
||||
chunk: createExpectedAnsiOutput('file1.txt'),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should strip ANSI color codes from output', async () => {
|
||||
|
||||
@@ -952,9 +952,13 @@ export class ShellExecutionService {
|
||||
|
||||
if (output !== finalOutput) {
|
||||
output = finalOutput;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-type-assertion
|
||||
const isCursorHidden = (headlessTerminal as any)._core?.coreService
|
||||
?.isCursorHidden as boolean | undefined;
|
||||
const event: ShellOutputEvent = {
|
||||
type: 'data',
|
||||
chunk: finalOutput,
|
||||
isCursorHidden,
|
||||
};
|
||||
onOutputEvent(event);
|
||||
ExecutionLifecycleService.emitEvent(ptyPid, event);
|
||||
@@ -1303,7 +1307,14 @@ export class ShellExecutionService {
|
||||
startLine,
|
||||
endLine,
|
||||
);
|
||||
const event: ShellOutputEvent = { type: 'data', chunk: bufferData };
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-type-assertion
|
||||
const isCursorHidden = (activePty.headlessTerminal as any)._core
|
||||
?.coreService?.isCursorHidden as boolean | undefined;
|
||||
const event: ShellOutputEvent = {
|
||||
type: 'data',
|
||||
chunk: bufferData,
|
||||
isCursorHidden,
|
||||
};
|
||||
ExecutionLifecycleService.emitEvent(pid, event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user