YouCompleteMe/python/ycm
zzbot c3b4884cd3
Auto merge of #3126 - micbou:fix-cursor-position-replace-chunk, r=micbou
[READY] Fix cursor position when replacing chunk

When replacing an area of the buffer with `ReplaceChunk`, we are replacing the whole last line of that area because the Python interface doesn't allow changing only some part of a line. If the cursor is positioned on that line just after the ending column of the replaced area, we expect the cursor to be moved depending on the amount of text replaced. However, since the whole line is replaced, Vim cannot figure where the cursor should be positioned and so the cursor is not moved. This leads to the cursor ending in an unexpected position after a FixIt is applied. Here's an illustration of the issue in TypeScript where an import statement is automatically inserted after selecting a completion:

![fixit-cursor-position-before](https://user-images.githubusercontent.com/10026824/44363871-be1ec400-a4c5-11e8-949b-14ada91bdc5e.gif)

The solution is to manually move the cursor in that case:

![fixit-cursor-position-after](https://user-images.githubusercontent.com/10026824/44364038-3a190c00-a4c6-11e8-8aca-4bc8ccb98edc.gif)

<!-- 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/3126)
<!-- Reviewable:end -->
2018-09-09 05:36:16 -07:00
..
client Auto merge of #3089 - micbou:tsserver-javascript, r=Valloric 2018-07-25 14:02:12 -07:00
tests Auto merge of #3126 - micbou:fix-cursor-position-replace-chunk, r=micbou 2018-09-09 05:36:16 -07:00
__init__.py Fixing python tests broken in rename 2013-05-19 20:06:14 -07:00
base.py Rewrite completion system 2017-06-21 02:32:57 +02:00
buffer.py Update JavaScript support and documentation 2018-07-25 22:15:01 +02:00
diagnostic_filter.py Do not install aliases from future 2017-03-18 18:24:48 +01:00
diagnostic_interface.py Update matches for all windows 2018-06-03 18:58:09 +02:00
omni_completer.py Improve omnifunc compliance when start column is invalid 2018-09-09 12:34:07 +02:00
paths.py Drop Python 2.6 and Python 3.3 2018-01-30 18:34:50 +01:00
syntax_parse.py Add flake8-ycm to test requirements 2018-05-30 02:53:28 +02:00
unsafe_thread_pool_executor.py Add flake8-ycm to test requirements 2018-05-30 02:53:28 +02:00
vimsupport.py Fix cursor position when replacing chunk 2018-09-09 12:38:44 +02:00
youcompleteme.py Support modifiers for GoTo commands 2018-07-24 18:07:41 +02:00