Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert mode . is sometimes mapped to ESC*i by YCM #2698

Closed
8 tasks
screwzm opened this issue Jun 29, 2017 · 10 comments · Fixed by #2707
Closed
8 tasks

insert mode . is sometimes mapped to ESC*i by YCM #2698

screwzm opened this issue Jun 29, 2017 · 10 comments · Fixed by #2707

Comments

@screwzm
Copy link

screwzm commented Jun 29, 2017

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • [ X ] I have read and understood YCM's CONTRIBUTING document.
  • [ X ] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [ X ] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [ X ] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key
insert mode . is somehow mapped to ESC*i by YCM after 0
questions:

  • What did you do?
    1. remove all other plugin and self-defined key mappings in .vimrc
    2. Enable YCM in Vundle only
    3. open some .h/.cc file, with YCM enabled, type 0
    4. remain in isert mode, Enter another line, type 0.

Include steps to reproduce here.

  1. open some .h/.cc file, with YCM enabled, type 0
  2. Enter another line, type 0.

Include description of a minimal test case, including any actual code required
in any .h/.cc file,
0 0.
to reproduce the issue.

  1. open some .h/.cc file, with YCM enabled, type 0
  2. Enter another line, type 0.
  • What did you expect to happen
    a raw char . is input after 0 without any side effects

Include description of the expected behaviour.
I just want to input the char .

  • What actually happened?
    After long investigation, I found that the . is sometimes mapled by YCM to ESC*i in vim insert mode.

Include description of the observed behaviour, including actual output,
For example, | indicates the position of the input . when iput "0 0.|" , the second . is mappled to ESC*i , and the result is "0| 0."
screenshots, etc.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 26 2017 13:40:28)

Place the output here, or a link to a gist.

Output of YcmDebugInfo

Place the output here, or a link to a gist.

Contents of YCM, ycmd and completion engine logfiles

Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by :YcmToggleLogs.

OS version, distribution, etc.

Linux middlebury 4.4.0-81-generic #104~14.04.1-Ubuntu SMP Wed Jun 14 12:45:52 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Include system information here.

Output of build/install commands

Include link to a gist containing the invocation and entire output of
install.py if reporting an installation issue.

@micbou
Copy link
Collaborator

micbou commented Jun 29, 2017

Could you fill the rest of the issue template? That would be helpful.

@micbou
Copy link
Collaborator

micbou commented Jun 29, 2017

I mean the full output of vim --version (not just the first line), the output of :YcmDebugInfo, and the logfiles contents (you can open the logfiles in the editor with the :YcmToggleLogs command).

@screwzm
Copy link
Author

screwzm commented Jul 3, 2017

@screwzm
Copy link
Author

screwzm commented Jul 3, 2017

@micbou All the required debug info is available here . https://gist.github.com/screwzm/4f86766730726e612c3070b9334178f6

@screwzm
Copy link
Author

screwzm commented Jul 4, 2017

No map of . is found side vim :imap though .. This is very annoying..

@bstaletic
Copy link
Collaborator

@screwzm
Are you sure you've compiled the upstream ycmd correctly? I've been messing with ycmd code (playing with python bindings) and when I compiled and tried to use a messed up ycmd it acted as if inoremap . .<Escape># was placed somewhere, but only until CursorHoldI event. The same thing was hapening with <Backspace> in some very specific situations.

So could you try a clean YCM/ycmd install?

@screwzm
Copy link
Author

screwzm commented Jul 7, 2017

@bstaletic I didi tried clean install , and the error remains under clean & successful build..

@micbou
Copy link
Collaborator

micbou commented Jul 7, 2017

Found the issue. This is caused by the default Vim omnifunc for C-family languages (ccomplete#Complete). More detail in PR #2707. You can either build YCM with the --clang-completer option (which I highly recommend if you want better C-family support) or try the PR.

zzbot added a commit that referenced this issue Jul 7, 2017
[READY] Restore cursor position after omnifunc call

When compiled without C-family support, YCM will use the default omnifunc from Vim (`ccomplete#Complete`) to provide semantic completion. This omnifunc calls [`searchdecl`](http://vimdoc.sourceforge.net/htmldoc/eval.html#searchdecl()) to find a declaration, which is supposed to move the cursor to that declaration. However, the cursor is not moved when called through the omni completion mapping (`CTRL-X CTRL-O`). Since PR #2657, YCM calls the omnifunc outside completion mode and thus the cursor is moved to the found declaration after typing `.` or `->`.

Considering this `searchdecl` trick may be used by other omnifuncs, we fix the issue by always restoring the cursor position after calling the omnifunc.

Fixes #2698.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2707)
<!-- Reviewable:end -->
@micbou
Copy link
Collaborator

micbou commented Jul 7, 2017

@screwzm Can you confirm this is fixed with the latest version of YCM?

@screwzm
Copy link
Author

screwzm commented Aug 25, 2017

@micbou This issue was fixed by the new merge.. Thanks .

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants