Skip to content

Cancel Auto-complete If Single Item Matches Text #283

Discussion options

You must be logged in to vote

I think I made this whole thing way too hard. I think it should just be:

buffer.auto_c_choose_single = false
events.connect(events.CHAR_ADDED, function()
  if buffer:auto_c_active() then
    buffer:auto_c_cancel()
  end

  textadept.editing.autocomplete('word')
end)

This isn't much more complicated than what I had originally. The only change is that I close the auto complete if it is already open. This works because Textadept is only looking for matching terms that are larger than what I already typed.

The reason this doesn't work without closing first is because if you exactly match the only item in your list then that means it doesn't find any terms it returns early never displaying the…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@eric-hemasystems
Comment options

@eric-hemasystems
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by eric-hemasystems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants