@@ -348,7 +348,87 @@ function! Test_ShowDetailedDiagnostic_Popup_WithCharacters()
348
348
% bwipe!
349
349
endfunction
350
350
351
- function ! Test_ShowDetailedDiagnostic_Popup_MultilineDiag ()
351
+ function ! Test_ShowDetailedDiagnostic_Popup_MultilineDiagNotFromStartOfLine ()
352
+ let f = tempname () . ' .cc'
353
+ execut ' edit' f
354
+ call setline ( 1 , [
355
+ \ ' int main () {' ,
356
+ \ ' int a \' ,
357
+ \ ' =\' ,
358
+ \ ' =' ,
359
+ \ ' 3;' ,
360
+ \ ' }' ,
361
+ \ ] )
362
+ call youcompleteme#test#setup#WaitForInitialParse ( {} )
363
+
364
+ call WaitForAssert ( {- >
365
+ \ assert_true (
366
+ \ py3eval (
367
+ \ ' len( ycm_state.CurrentBuffer()._diag_interface._diagnostics )'
368
+ \ ) ) } )
369
+
370
+ " Start of multiline diagnostic.
371
+ call cursor ( [ 2 , 9 ] )
372
+ YcmShowDetailedDiagnostic popup
373
+
374
+ " let popup_location = screenpos( bufwinid( '%' ), 3, 13 )
375
+ let id = popup_locate ( 3 , 30 )
376
+ call assert_notequal ( 0 , id, " Couldn't find popup!" )
377
+
378
+ call youcompleteme#test#popup#CheckPopupPosition ( id, {
379
+ \ ' visible' : 1 ,
380
+ \ ' col' : 16 ,
381
+ \ ' line' : 3 ,
382
+ \ } )
383
+ call assert_match (
384
+ \ " ^Variable 'rd' declared const here.*" ,
385
+ \ getbufline ( winbufnr (id), 1 , ' $' )[ 0 ] )
386
+
387
+ " Middle of multiline diagnostic.
388
+ call cursor ( [ 3 , 1 ] )
389
+ YcmShowDetailedDiagnostic popup
390
+
391
+ let popup_location = screenpos ( bufwinid ( ' %' ), 3 , 13 )
392
+ let id = popup_locate ( popup_location[ ' row' ], popup_location[ ' col' ] )
393
+ call assert_notequal ( 0 , id, " Couldn't find popup!" )
394
+
395
+ " End of multiline diagnostic.
396
+ call youcompleteme#test#popup#CheckPopupPosition ( id, {
397
+ \ ' visible' : 1 ,
398
+ \ ' col' : 16 ,
399
+ \ ' line' : 3 ,
400
+ \ } )
401
+ call assert_match (
402
+ \ " ^Variable 'rd' declared const here.*" ,
403
+ \ getbufline ( winbufnr (id), 1 , ' $' )[ 0 ] )
404
+
405
+ call cursor ( [ 4 , 1 ] )
406
+ YcmShowDetailedDiagnostic popup
407
+
408
+ let popup_location = screenpos ( bufwinid ( ' %' ), 3 , 13 )
409
+ let id = popup_locate ( popup_location[ ' row' ], popup_location[ ' col' ] )
410
+ call assert_notequal ( 0 , id, " Couldn't find popup!" )
411
+
412
+ call youcompleteme#test#popup#CheckPopupPosition ( id, {
413
+ \ ' visible' : 1 ,
414
+ \ ' col' : 16 ,
415
+ \ ' line' : 3 ,
416
+ \ } )
417
+ call assert_match (
418
+ \ " ^Variable 'rd' declared const here.*" ,
419
+ \ getbufline ( winbufnr (id), 1 , ' $' )[ 0 ] )
420
+
421
+ " From vim's test_popupwin.vim
422
+ " trigger the check for last_cursormoved by going into insert mode
423
+ call test_override ( ' char_avail' , 1 )
424
+ call feedkeys ( " ji\<Esc> " , ' xt' )
425
+ call assert_equal ( {}, popup_getpos ( id ) )
426
+ call test_override ( ' ALL' , 0 )
427
+
428
+ % bwipe!
429
+ endfunction
430
+
431
+ function ! Test_ShowDetailedDiagnostic_Popup_MultilineDiagFromStartOfLine ()
352
432
let f = tempname () . ' .cc'
353
433
execut ' edit' f
354
434
call setline ( 1 , [
0 commit comments