mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(tui): apply path/@ completion on Enter
Completion selection on Enter was gated to slash commands only
(value.startsWith('/')), so @file, ./path, and ~/path completions fell
through and submitted the incomplete input instead of inserting the
highlighted row.
Guard on completions.length && compReplace > 0 — useCompletion already
scopes population to slash and path tokens, and the next !== value check
keeps plain-text submits working when the completion is already applied.
This commit is contained in:
parent
ce98e1ef11
commit
4b0686f63d
22 changed files with 206 additions and 76 deletions
|
|
@ -234,11 +234,11 @@ export function useSubmission(opts: UseSubmissionOptions) {
|
|||
|
||||
const submit = useCallback(
|
||||
(value: string) => {
|
||||
if (value.startsWith('/') && composerState.completions.length) {
|
||||
if (composerState.completions.length) {
|
||||
const row = composerState.completions[composerState.compIdx]
|
||||
|
||||
if (row?.text) {
|
||||
const text = row.text.startsWith('/') && composerState.compReplace > 0 ? row.text.slice(1) : row.text
|
||||
const text = value.startsWith('/') && row.text.startsWith('/') ? row.text.slice(1) : row.text
|
||||
const next = value.slice(0, composerState.compReplace) + text
|
||||
|
||||
if (next !== value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue