Rewrite completion function for "near" source

Rewrite the way in which lift#near#complete() works:

- Factor out the code that scans a line for completion candidates into a
  separate function.
- Backwards lines are searched first, then forward lines. The existing logic
  to search forward was broken, and forward lines were never searched.
- Make sure duplicated candidates are not returned by using a dictionary as a
  set to track which words have already been "seen" and returned as
  candidates.

This patch closes issue #1.