mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
Merge branch 'main' into feature/arena-agent-collaboration
This commit is contained in:
commit
fe304a0c32
78 changed files with 3777 additions and 511 deletions
|
|
@ -1957,6 +1957,25 @@ describe('InputPrompt', () => {
|
|||
});
|
||||
|
||||
describe('command search (Ctrl+R when not in shell)', () => {
|
||||
it('passes newest-first user history to command search', async () => {
|
||||
props.shellModeActive = false;
|
||||
props.userMessages = ['oldest', 'middle', 'newest'];
|
||||
|
||||
const { unmount } = renderWithProviders(<InputPrompt {...props} />);
|
||||
await wait();
|
||||
|
||||
const commandSearchCall =
|
||||
mockedUseReverseSearchCompletion.mock.calls.find(
|
||||
([, history]) =>
|
||||
Array.isArray(history) &&
|
||||
history.length === 3 &&
|
||||
history.includes('newest'),
|
||||
);
|
||||
|
||||
expect(commandSearchCall?.[1]).toEqual(['newest', 'middle', 'oldest']);
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('enters command search on Ctrl+R and shows suggestions', async () => {
|
||||
props.shellModeActive = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import type React from 'react';
|
||||
import { useCallback, useEffect, useState, useRef } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState, useRef } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { SuggestionsDisplay, MAX_WIDTH } from './SuggestionsDisplay.js';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
|
|
@ -199,9 +199,14 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||
reverseSearchActive,
|
||||
);
|
||||
|
||||
const commandSearchHistory = useMemo(
|
||||
() => [...userMessages].reverse(),
|
||||
[userMessages],
|
||||
);
|
||||
|
||||
const commandSearchCompletion = useReverseSearchCompletion(
|
||||
buffer,
|
||||
userMessages,
|
||||
commandSearchHistory,
|
||||
commandSearchActive,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue