Fix tab completion for absolute paths

- Fix //tmp issue: distinguish slash commands from file paths by checking if anything precedes the /
- Fix symlinks to directories (like /tmp) not getting trailing slash
This commit is contained in:
Mario Zechner 2025-12-21 02:41:38 +01:00
parent bf51dd4126
commit 918750eb9e
3 changed files with 24 additions and 7 deletions

View file

@ -1245,7 +1245,7 @@ export class Editor implements Component {
const beforeCursor = currentLine.slice(0, this.state.cursorCol);
// Check if we're in a slash command context
if (beforeCursor.trimStart().startsWith("/")) {
if (beforeCursor.trimStart().startsWith("/") && !beforeCursor.trimStart().includes(" ")) {
this.handleSlashCommandCompletion();
} else {
this.forceFileAutocomplete();
@ -1253,8 +1253,6 @@ export class Editor implements Component {
}
private handleSlashCommandCompletion(): void {
// For now, fall back to regular autocomplete (slash commands)
// This can be extended later to handle command-specific argument completion
this.tryTriggerAutocomplete(true);
}