From d61944098aea34af3724010fe532a794cbb24441 Mon Sep 17 00:00:00 2001 From: micbou Date: Sun, 17 Sep 2017 20:16:21 +0200 Subject: [PATCH] Do not open location list at the bottom of screen The location list is specific to the current window so it should be opened inside the current window, not to full width at the bottom of the screen. --- README.md | 4 ++-- doc/youcompleteme.txt | 4 ++-- python/ycm/tests/vimsupport_test.py | 2 +- python/ycm/vimsupport.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 95d675e7..693a75a0 100644 --- a/README.md +++ b/README.md @@ -1658,8 +1658,8 @@ Autocommands This `User` autocommand is fired when YCM opens the location list window in response to the `YcmDiags` command. By default, the location list window is -opened to full width at the bottom of the screen and its height is set to fit -all entries. This behavior can be overridden by using the `YcmLocationOpened` +opened to the bottom of the current window and its height is set to fit all +entries. This behavior can be overridden by using the `YcmLocationOpened` autocommand which is triggered while the cursor is in the location list window. For instance: ```viml diff --git a/doc/youcompleteme.txt b/doc/youcompleteme.txt index d21a352b..d2ab4f73 100644 --- a/doc/youcompleteme.txt +++ b/doc/youcompleteme.txt @@ -1955,8 +1955,8 @@ The *YcmLocationOpened* autocommand This 'User' autocommand is fired when YCM opens the location list window in response to the 'YcmDiags' command. By default, the location list window is -opened to full width at the bottom of the screen and its height is set to fit -all entries. This behavior can be overridden by using the |YcmLocationOpened| +opened to the bottom of the current window and its height is set to fit all +entries. This behavior can be overridden by using the |YcmLocationOpened| autocommand which is triggered while the cursor is in the location list window. For instance: > diff --git a/python/ycm/tests/vimsupport_test.py b/python/ycm/tests/vimsupport_test.py index 6a4c1133..7394a0ca 100644 --- a/python/ycm/tests/vimsupport_test.py +++ b/python/ycm/tests/vimsupport_test.py @@ -60,7 +60,7 @@ def SetLocationList_test( vim_eval ): def OpenLocationList_test( vim_command, fitting_height, variable_exists ): vimsupport.OpenLocationList( focus = False, autoclose = True ) vim_command.assert_has_exact_calls( [ - call( 'botright lopen' ), + call( 'lopen' ), call( 'au WinLeave q' ), call( 'doautocmd User YcmLocationOpened' ), call( 'silent! wincmd p' ) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 02565bc7..82881083 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -250,13 +250,13 @@ def SetLocationList( diagnostics ): def OpenLocationList( focus = False, autoclose = False ): - """Open the location list to full width at the bottom of the screen with its + """Open the location list to the bottom of the current window with its height automatically set to fit all entries. This behavior can be overridden by using the YcmLocationOpened autocommand. When focus is set to True, the location list window becomes the active window. When autoclose is set to True, the location list window is automatically closed after an entry is selected.""" - vim.command( 'botright lopen' ) + vim.command( 'lopen' ) SetFittingHeightForCurrentWindow()