@@ -168,6 +168,7 @@ function testVim(name, run, opts, expectedFail) {
168168 var cm = CodeMirror ( place , vimOpts ) ;
169169 var vim = CodeMirror . Vim . maybeInitVimState_ ( cm ) ;
170170 CodeMirror . Vim . mapclear ( ) ;
171+ CodeMirror . Vim . langmap ( '' ) ;
171172
172173 cm . focus ( ) ;
173174 // workaround for cm5 slow polling in blurred window
@@ -5676,6 +5677,30 @@ isOldCodeMirror || testVim('langmap_visual_block_no_ctrl_remap', function(cm, vi
56765677 eq ( '1hworld\n5hworld\nahworld' , cm . getValue ( ) ) ;
56775678} , { value : '1234\n5678\nabcdefg' } ) ;
56785679
5680+ testVim ( 'rendered_cursor_position_cm6' , function ( cm , vim , helpers ) {
5681+ if ( ! cm . cm6 ) return ;
5682+ cm . setCursor ( 0 , 1 ) ;
5683+ helpers . doKeys ( 'V' ) ;
5684+ function testCursorPosition ( line , ch ) {
5685+ cm . refresh ( ) ;
5686+ var coords = cm . charCoords ( { line, ch} ) ;
5687+ var cursorRect = cm . getWrapperElement ( ) . querySelector ( ".cm-fat-cursor" ) . getBoundingClientRect ( ) ;
5688+ var contentRect = cm . getInputField ( ) . getBoundingClientRect ( ) ;
5689+
5690+ is ( Math . abs ( coords . top - ( cursorRect . top - contentRect . top ) ) < 2 ) ;
5691+ is ( Math . abs ( coords . left - ( cursorRect . left - contentRect . left ) ) < 2 ) ;
5692+ }
5693+ testCursorPosition ( 0 , 4 ) ;
5694+ helpers . doKeys ( 'j' ) ;
5695+ testCursorPosition ( 1 , 0 ) ;
5696+ helpers . doKeys ( 'j' ) ;
5697+ testCursorPosition ( 2 , 0 ) ;
5698+ helpers . doKeys ( 'j' ) ;
5699+ testCursorPosition ( 3 , 4 ) ;
5700+
5701+ } , { value : '1234\n\n\n5678\nabcdefg' } ) ;
5702+
5703+
56795704
56805705async function delay ( t ) {
56815706 return await new Promise ( resolve => setTimeout ( resolve , t ) ) ;
0 commit comments