@@ -53,6 +53,7 @@ export function initVim(CM) {
5353 * @typedef { import("./types").Marker } Marker
5454 * @typedef { import("./types").InputStateInterface } InputStateInterface
5555 * @typedef { import("./types").SearchStateInterface } SearchStateInterface
56+ * @typedef { import("./types").InsertModeChanges } InsertModeChanges
5657 */
5758 var Pos = CM . Pos ;
5859
@@ -1358,19 +1359,24 @@ export function initVim(CM) {
13581359 * inserted at the cursor position.)
13591360 */
13601361 class Register {
1362+ /** @arg {string} [text] @arg {boolean} [linewise] @arg {boolean } [blockwise] */
13611363 constructor ( text , linewise , blockwise ) {
13621364 this . clear ( ) ;
13631365 this . keyBuffer = [ text || '' ] ;
1366+ /** @type {InsertModeChanges[] } */
13641367 this . insertModeChanges = [ ] ;
1368+ /** @type {string[] }*/
13651369 this . searchQueries = [ ] ;
13661370 this . linewise = ! ! linewise ;
13671371 this . blockwise = ! ! blockwise ;
13681372 }
1373+ /** @arg {string} [text] @arg {boolean} [linewise] @arg {boolean } [blockwise] */
13691374 setText ( text , linewise , blockwise ) {
13701375 this . keyBuffer = [ text || '' ] ;
13711376 this . linewise = ! ! linewise ;
13721377 this . blockwise = ! ! blockwise ;
13731378 }
1379+ /** @arg {string} text @arg {boolean} [linewise] */
13741380 pushText ( text , linewise ) {
13751381 // if this register has ever been set to linewise, use linewise.
13761382 if ( linewise ) {
@@ -1381,9 +1387,11 @@ export function initVim(CM) {
13811387 }
13821388 this . keyBuffer . push ( text ) ;
13831389 }
1390+ /** @arg {InsertModeChanges} changes */
13841391 pushInsertModeChanges ( changes ) {
13851392 this . insertModeChanges . push ( createInsertModeChanges ( changes ) ) ;
13861393 }
1394+ /** @arg {string} query */
13871395 pushSearchQuery ( query ) {
13881396 this . searchQueries . push ( query ) ;
13891397 }
@@ -1803,7 +1811,7 @@ export function initVim(CM) {
18031811 ( keyName == '<BS>' && query == '' ) ) {
18041812 vimGlobalState . searchHistoryController . pushInput ( query ) ;
18051813 vimGlobalState . searchHistoryController . reset ( ) ;
1806- updateSearchQuery ( cm , originalQuery ) ;
1814+ updateSearchQuery ( cm , originalQuery ?. source || "" ) ;
18071815 clearSearchHighlight ( cm ) ;
18081816 cm . scrollTo ( originalScrollPos . left , originalScrollPos . top ) ;
18091817 CM . e_stop ( e ) ;
@@ -3777,7 +3785,7 @@ export function initVim(CM) {
37773785 'visualLine' : vim . visualLine ,
37783786 'visualBlock' : vim . visualBlock } ;
37793787 }
3780- /** @arg {CodeMirrorV} cm @arg {Pos} start @arg {Pos} end @returns {[Pos, Pos] } */
3788+ /** @arg {CodeMirrorV} cm @arg {Pos} start @arg {Pos} end @arg {Boolean} [move] @ returns {[Pos, Pos] } */
37813789 function expandSelection ( cm , start , end , move ) {
37823790 var sel = cm . state . vim . sel ;
37833791 var head = move ? start : sel . head ;
@@ -5170,16 +5178,14 @@ export function initVim(CM) {
51705178 * If the query contains the /i in the flag part of the regular expression,
51715179 * then both ignoreCase and smartCase are ignored, and 'i' will be passed
51725180 * through to the Regex object.
5173- * @arg {string|RegExp } query
5181+ * @arg {string} query
51745182 * @arg {boolean} ignoreCase
51755183 * @arg {boolean} smartCase
51765184 */
51775185 function parseQuery ( query , ignoreCase , smartCase ) {
51785186 // First update the last search register
51795187 var lastSearchRegister = vimGlobalState . registerController . getRegister ( '/' ) ;
51805188 lastSearchRegister . setText ( query ) ;
5181- // Check if the query is already a regex.
5182- if ( query instanceof RegExp ) { return query ; }
51835189 // First try to extract regex + flags from the input. If no flags found,
51845190 // extract just the regex. IE does not accept flags directly defined in
51855191 // the regex string in the form /regex/flags
@@ -5305,7 +5311,7 @@ export function initVim(CM) {
53055311 // Returns true if the query is valid.
53065312 /**
53075313 * @arg {CodeMirrorV} cm
5308- * @arg {string | RegExp } rawQuery
5314+ * @arg {string } rawQuery
53095315 * @arg {boolean | undefined} [ignoreCase]
53105316 * @arg {boolean | undefined} [smartCase]
53115317 */
@@ -6115,6 +6121,7 @@ export function initVim(CM) {
61156121 } ,
61166122 /** @arg {CodeMirrorV} cm @arg {ExParams} params*/
61176123 normal : function ( cm , params ) {
6124+ var noremap = false ;
61186125 var argString = params . argString ;
61196126 if ( argString && argString [ 0 ] == '!' ) {
61206127 argString = argString . slice ( 1 ) ;
@@ -6130,13 +6137,13 @@ export function initVim(CM) {
61306137 var lineEnd = isNaN ( params . lineEnd ) ? line : params . lineEnd ;
61316138 for ( var i = line ; i <= lineEnd ; i ++ ) {
61326139 cm . setCursor ( i , 0 ) ;
6133- doKeyToKey ( cm , params . argString . trimStart ( ) ) ;
6140+ doKeyToKey ( cm , params . argString . trimStart ( ) , { noremap } ) ;
61346141 if ( cm . state . vim . insertMode ) {
61356142 exitInsertMode ( cm , true ) ;
61366143 }
61376144 }
61386145 } else {
6139- doKeyToKey ( cm , params . argString . trimStart ( ) ) ;
6146+ doKeyToKey ( cm , params . argString . trimStart ( ) , { noremap } ) ;
61406147 if ( cm . state . vim . insertMode ) {
61416148 exitInsertMode ( cm , true ) ;
61426149 }
0 commit comments