fix to changes in autocomplete insertion
minor fix
addressed review comments
Merge pull request #3009 from aparajit-pratap/fixAggressiveAutoComplete

Fix in autocomplete for insertion of completion item and closing completion window