Skip to content

Commit

Permalink
modified Autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias314 committed Dec 21, 2024
1 parent 52b0a9f commit f13dc1c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/action/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,20 +922,21 @@ func (h *BufPane) Autocomplete() bool {
return false
}

if b.HasSuggestions {
b.CycleAutocomplete(true)
return true
}

if h.Cursor.X == 0 {
return false
}

r := h.Cursor.RuneUnder(h.Cursor.X)
prev := h.Cursor.RuneUnder(h.Cursor.X - 1)
if !util.IsAutocomplete(prev) || util.IsWordChar(r) {
// don't autocomplete if cursor is within a word
return false
}

if b.HasSuggestions {
b.CycleAutocomplete(true)
return true
}
return b.Autocomplete(buffer.BufferComplete)
}

Expand Down

0 comments on commit f13dc1c

Please sign in to comment.