typeahead: Update / hide typeahead menu on clicking outside.
typeahead: Update / hide typeahead menu on clicking outside.

When a user clicks outside the typeahead menu, inside the typing area,
the cursor position potentially changes, so `lookup` is called, which
considers the new cursor position and accordingly hides, continues
showing, or updates the typeahead menu.

This fixes the bug where even after clicking elsewhere, the old
typeahead menu continued showing and on making a selection, the text
was inserted at the wrong (new) position.

Fixes: #21302.

rht/zulip,kou/zulip,rht/zulip,zulip/zulip,zulip/zulip,kou/zulip,andersk/zulip,zulip/zulip,andersk/zulip,kou/zulip,rht/zulip,zulip/zulip,rht/zulip,kou/zulip,kou/zulip,andersk/zulip,rht/zulip,andersk/zulip,kou/zulip,rht/zulip,zulip/zulip,andersk/zulip,andersk/zulip,kou/zulip,zulip/zulip,zulip/zulip,andersk/zulip,rht/zulip