Refactor autocomplete

Depends on #38 (well, sorta– all of those changes are present in this branch.)

An attempt to refactor the auto-complete component such that the main logic is separate from the component itself. This makes everything more testable as well (tests are included).
ac/cursor-position