mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
fix(input) Resolve cases where escape was broken (#6304)
This commit is contained in:
parent
1a2906a8ad
commit
bd5e49c5ff
14 changed files with 697 additions and 582 deletions
|
|
@ -21,8 +21,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import { render } from 'ink-testing-library';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import { renderWithProviders } from '../../test-utils/render.js';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { SettingsDialog } from './SettingsDialog.js';
|
||||
import { LoadedSettings, SettingScope } from '../../config/settings.js';
|
||||
|
|
@ -102,7 +102,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame, stdin, unmount } = render(
|
||||
const { lastFrame, stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onRestartRequest = vi.fn();
|
||||
|
||||
const { unmount } = render(
|
||||
const { unmount } = renderWithProviders(
|
||||
<SettingsDialog
|
||||
settings={settings}
|
||||
onSelect={() => {}}
|
||||
|
|
@ -327,7 +327,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onRestartRequest = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog
|
||||
settings={settings}
|
||||
onSelect={() => {}}
|
||||
|
|
@ -349,7 +349,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings({ vimMode: true });
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ describe('SettingsDialog', () => {
|
|||
);
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<VimModeProvider settings={settings}>
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />
|
||||
</VimModeProvider>,
|
||||
|
|
@ -492,7 +492,7 @@ describe('SettingsDialog', () => {
|
|||
);
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame, unmount } = render(
|
||||
const { lastFrame, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -541,7 +541,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { unmount } = render(
|
||||
const { unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ describe('SettingsDialog', () => {
|
|||
);
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ describe('SettingsDialog', () => {
|
|||
);
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -591,7 +591,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -610,7 +610,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings({ vimMode: true }); // Start with vimMode enabled
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -626,7 +626,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings({ vimMode: true }); // Start with vimMode enabled
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -659,7 +659,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame, stdin, unmount } = render(
|
||||
const { lastFrame, stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ describe('SettingsDialog', () => {
|
|||
);
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -705,7 +705,7 @@ describe('SettingsDialog', () => {
|
|||
const onSelect = vi.fn();
|
||||
|
||||
// Should not crash even if some settings are missing definitions
|
||||
const { lastFrame } = render(
|
||||
const { lastFrame } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -718,7 +718,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -763,7 +763,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -792,7 +792,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings({ vimMode: true });
|
||||
const onSelect = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog settings={settings} onSelect={onSelect} />,
|
||||
);
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ describe('SettingsDialog', () => {
|
|||
const settings = createMockSettings();
|
||||
const onRestartRequest = vi.fn();
|
||||
|
||||
const { stdin, unmount } = render(
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<SettingsDialog
|
||||
settings={settings}
|
||||
onSelect={() => {}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue