Auto merge of #2889 - bstaletic:PostVimMassage_truncate_fix, r=puremourning

[READY] Fix truncation of messages when len(message) == vim_width

# PR Prelude

Thank you for working on YCM! :)

**Please complete these steps and check these boxes (by putting an `x` inside
the brackets) _before_ filing your PR:**

- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [x] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [x] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

# Why this change is necessary and useful

[Please explain **in detail** why the changes in this PR are needed.]

When the message is exactly as wide as the vim window, vim still
displays "press enter..." message.

The bug can be demonstrated if we hardcode the `message` to `&columns * 'a'` and forcing `truncate` to `True`.

No tests because I didn't think it was necessary.

[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md

<!-- 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/2889)
<!-- Reviewable:end -->
This commit is contained in:
zzbot 2018-01-31 13:35:10 -08:00 committed by GitHub
commit 9aa754c8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -464,7 +464,7 @@ def PostVimMessage( message, warning = True, truncate = False ):
vim_width = GetIntValue( '&columns' ) vim_width = GetIntValue( '&columns' )
message = message.replace( '\n', ' ' ) message = message.replace( '\n', ' ' )
if len( message ) > vim_width: if len( message ) >= vim_width:
message = message[ : vim_width - 4 ] + '...' message = message[ : vim_width - 4 ] + '...'
old_ruler = GetIntValue( '&ruler' ) old_ruler = GetIntValue( '&ruler' )