Skip to content

Commit 8d968a3

Browse files
authored
Merge pull request #46 from nathfavour/master
Fix double slash in suggestions
2 parents a94114a + 8d1a1ba commit 8d968a3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cmd/vibeaura/chat.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,16 @@ func (m *model) applySuggestion() {
308308

309309
val := m.textarea.Value()
310310
words := strings.Fields(val)
311+
312+
suggestion := m.suggestions[m.suggestionIdx]
313+
// Avoid doubling trigger characters (e.g. //help or ##file)
314+
trimmed := strings.TrimPrefix(suggestion, m.triggerChar)
315+
replacement := m.triggerChar + trimmed
316+
311317
if len(words) == 0 {
312-
m.textarea.SetValue(m.suggestions[m.suggestionIdx] + " ")
318+
m.textarea.SetValue(replacement + " ")
313319
} else {
314-
words[len(words)-1] = m.triggerChar + m.suggestions[m.suggestionIdx]
320+
words[len(words)-1] = replacement
315321
m.textarea.SetValue(strings.Join(words, " ") + " ")
316322
}
317323
m.textarea.SetCursor(len(m.textarea.Value()))

0 commit comments

Comments
 (0)