Properly update final_location after completion popup closes.

This ensures anyone else who relies on it in the rest of the
input handling chain (which is blocked by the completion
popup's modality) will have the right value. In this case, we
can just set final_location to the caret, since the completion
popup method takes care of updating the caret appropriately
when/if the text insertion step wraps up.
When completing, don't use insertSnippet: if we're in a snippet.

This ensures we don't cancel the current snippet when we're
autocompleting while inside one, but it also ensures we
don't do the same when we explicitly invoke the completion
box, which was an existing bug.
Remember key manager for autocomplete cancel.

Before, when the user cancelled the completion popup
during autocomplete, we tried to pass on the cancellation
key combo to the existing key manager. Unfortunately we
did this after the completion controller had been reset, which
meant there was no key manager to send it to. We now
save the key manager before resetting and then pass it the
keys after we run the reset. This is so that the key manager
receives the keys after the completion controller is fully
dismissed.