mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-14 03:50:49 -07:00
fix(ui): restore slash command autocomplete space and fix enter execution
This restores the original autocomplete behavior where hitting Tab on a slash command suggestion correctly inserts a trailing space, allowing the user to naturally type the next argument or subcommand. It also changes the Enter key execution logic to correctly execute a command if it has an action and no completion function, ignoring the autoExecute flag. This matches the expected user behavior where selecting a command like `/stats` and pressing Enter immediately executes it, instead of simply autocompleting it without execution.
This commit is contained in:
@@ -481,7 +481,7 @@ describe('useCommandCompletion', () => {
|
||||
});
|
||||
|
||||
describe('handleAutocomplete', () => {
|
||||
it('should complete a partial command and NOT add a space if it has an action', async () => {
|
||||
it('should complete a partial command and ADD a space even if it has an action', async () => {
|
||||
setupMocks({
|
||||
slashSuggestions: [{ label: 'memory', value: 'memory' }],
|
||||
slashCompletionRange: {
|
||||
@@ -502,7 +502,7 @@ describe('useCommandCompletion', () => {
|
||||
result.current.handleAutocomplete(0);
|
||||
});
|
||||
|
||||
expect(result.current.textBuffer.text).toBe('/memory');
|
||||
expect(result.current.textBuffer.text).toBe('/memory ');
|
||||
});
|
||||
|
||||
it('should complete a partial command and ADD a space if it has NO action (e.g. just a parent)', async () => {
|
||||
|
||||
Reference in New Issue
Block a user