@@ -159,6 +159,15 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
159
159
# inserting the char ?
160
160
col = int ( screen_pos [ 'curscol' ] ) - 2
161
161
162
+ # Vim stops shifting the popup to the left if we turn on soft-wrapping.
163
+ # Instead, we want to first shift the popup to the left and then
164
+ # and then turn on wrapping.
165
+ max_line_length = max ( len ( item [ 'text' ] ) for item in buf_lines )
166
+ vim_width = vimsupport .GetIntValue ( '&columns' )
167
+ line_available = vim_width - max ( col , 1 )
168
+ if max_line_length > line_available :
169
+ col = vim_width - max_line_length
170
+
162
171
if col <= 0 :
163
172
col = 1
164
173
@@ -172,6 +181,7 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
172
181
# cursorline. So instead, we manually set 'cursorline' in the popup window
173
182
# and enable syntax based on the current file syntax)
174
183
"flip" : 1 ,
184
+ "fixed" : 1 ,
175
185
"padding" : [ 0 , 1 , 0 , 1 ], # Pad 1 char in X axis to match completion menu
176
186
"hidden" : int ( state .state == SignatureHelpState .ACTIVE_SUPPRESSED )
177
187
}
@@ -196,7 +206,7 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
196
206
197
207
active_signature = int ( signature_info .get ( 'activeSignature' , 0 ) )
198
208
vim .eval ( f"win_execute( { state .popup_win_id } , "
199
- f"'set syntax={ syntax } cursorline | "
209
+ f"'set syntax={ syntax } cursorline wrap | "
200
210
f"call cursor( [ { active_signature + 1 } , 1 ] )' )" )
201
211
202
212
return state
0 commit comments