feat: add Rewind Confirmation dialog and Rewind Viewer component (#15717)

This commit is contained in:
Adib234
2026-01-14 10:22:21 -05:00
committed by GitHub
parent 3b55581aaf
commit dfb7dc7069
19 changed files with 1318 additions and 27 deletions

View File

@@ -1870,11 +1870,11 @@ describe('InputPrompt', () => {
});
});
describe('enhanced input UX - double ESC clear functionality', () => {
describe('enhanced input UX - keyboard shortcuts', () => {
beforeEach(() => vi.useFakeTimers());
afterEach(() => vi.useRealTimers());
it('should clear buffer on second ESC press', async () => {
it('should clear buffer on Ctrl-C', async () => {
const onEscapePromptChange = vi.fn();
props.onEscapePromptChange = onEscapePromptChange;
props.buffer.setText('text to clear');
@@ -1884,14 +1884,7 @@ describe('InputPrompt', () => {
);
await act(async () => {
stdin.write('\x1B');
vi.advanceTimersByTime(100);
expect(onEscapePromptChange).toHaveBeenCalledWith(false);
});
await act(async () => {
stdin.write('\x1B');
stdin.write('\x03');
vi.advanceTimersByTime(100);
expect(props.buffer.setText).toHaveBeenCalledWith('');
@@ -1900,10 +1893,10 @@ describe('InputPrompt', () => {
unmount();
});
it('should clear buffer on double ESC', async () => {
it('should submit /rewind on double ESC', async () => {
const onEscapePromptChange = vi.fn();
props.onEscapePromptChange = onEscapePromptChange;
props.buffer.setText('text to clear');
props.buffer.setText('some text');
const { stdin, unmount } = renderWithProviders(
<InputPrompt {...props} />,
@@ -1913,8 +1906,7 @@ describe('InputPrompt', () => {
stdin.write('\x1B\x1B');
vi.advanceTimersByTime(100);
expect(props.buffer.setText).toHaveBeenCalledWith('');
expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled();
expect(props.onSubmit).toHaveBeenCalledWith('/rewind');
});
unmount();
});