Fixed bug in autocomplete

When typing special key combinations (like cmd-d), exception was thrown.

See also issue: TypeError: Cannot read property 'charCodeAt' of
undefined #99