{"action":"created","issue":{"url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/431","labels_url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/431/labels{/name}","comments_url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/431/comments","events_url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/431/events","html_url":"https://github.com/Rip-Rip/clang_complete/issues/431","id":51180240,"number":431,"title":"Pressing enter inserts HandlePossibleSelectionEnter signature after second completion","user":{"login":"chaserhkj","id":1768423,"avatar_url":"https://avatars.githubusercontent.com/u/1768423?v=3","gravatar_id":"","url":"https://api.github.com/users/chaserhkj","html_url":"https://github.com/chaserhkj","followers_url":"https://api.github.com/users/chaserhkj/followers","following_url":"https://api.github.com/users/chaserhkj/following{/other_user}","gists_url":"https://api.github.com/users/chaserhkj/gists{/gist_id}","starred_url":"https://api.github.com/users/chaserhkj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaserhkj/subscriptions","organizations_url":"https://api.github.com/users/chaserhkj/orgs","repos_url":"https://api.github.com/users/chaserhkj/repos","events_url":"https://api.github.com/users/chaserhkj/events{/privacy}","received_events_url":"https://api.github.com/users/chaserhkj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-12-06T11:55:32Z","updated_at":"2015-01-18T19:52:39Z","closed_at":null,"body":"I'm using supertab together with clang_complete and encountered this issue.\r\n\r\nAfter using `<Tab>`, `<c-x><c-u>` or `<c-x><c-o>` key bindings to perform completion in some C/C++ file 2 times, all enter key stokes in the buffer in the insertion mode would lead to the insertion of string `<SNR>(some number)_HandlePossibleSelectionEnter()` rather than the insertion of a new line.\r\n\r\nI'm running on vim 7.4.527 with gentoo patch set.\r\n\r\nWhen no completion is performed, my `verbose imap <CR>` gives output `No mapping found`\r\n\r\nWhen one completion has been performed, my `verbose imap <CR>` gives output `i <CR>  @<SNR>(some number)_HandlePossibleSelectionEnter()`, and all thing works well\r\n\r\nWhen two completions have been performed, my `verbose imap <CR>` gives output `i <CR>  &@<SNR>(some number)_HandlePossibleSelectionEnter()`, and this issue begins to appear\r\n\r\nAny additional information could be provided if requested."},"comment":{"url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/comments/70422724","html_url":"https://github.com/Rip-Rip/clang_complete/issues/431#issuecomment-70422724","issue_url":"https://api.github.com/repos/Rip-Rip/clang_complete/issues/431","id":70422724,"user":{"login":"wilywampa","id":4472522,"avatar_url":"https://avatars.githubusercontent.com/u/4472522?v=3","gravatar_id":"","url":"https://api.github.com/users/wilywampa","html_url":"https://github.com/wilywampa","followers_url":"https://api.github.com/users/wilywampa/followers","following_url":"https://api.github.com/users/wilywampa/following{/other_user}","gists_url":"https://api.github.com/users/wilywampa/gists{/gist_id}","starred_url":"https://api.github.com/users/wilywampa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilywampa/subscriptions","organizations_url":"https://api.github.com/users/wilywampa/orgs","repos_url":"https://api.github.com/users/wilywampa/repos","events_url":"https://api.github.com/users/wilywampa/events{/privacy}","received_events_url":"https://api.github.com/users/wilywampa/received_events","type":"User","site_admin":false},"created_at":"2015-01-18T19:52:39Z","updated_at":"2015-01-18T19:52:39Z","body":"Thanks for testing.\r\n\r\nIt looks like the problem is that `<CR>` never gets unmapped unless a snippet is chosen. It also looks `<CR>` is unmapped the first time the cursor moves after it is mapped so I don't see how it can be used to trigger a snippet at all.\r\n\r\nI moved the code that unmaps `<CR>` and `<C-y>` into a separate function which is called when a snippet is triggered, on `InsertLeave`, and on `CompleteDone` if the `CompleteDone` event exists (it was introduced somewhere in Vim 7.3 - I wish it were easier to track down which version introduced a given feature). I installed UltiSnips and tested with no `<CR>` imap, a non-buffer `<CR>` imap and a buffer `<CR>` imap and it all seems to be working right now. Please give it another try.\r\n\r\nI had never tried UltiSnips before because I use NeoComplete and NeoSnippet. The insertion of function arguments is pretty nifty so I might keep UltiSnips if I can make it play nice with other plugins."}}