@@ -5,12 +5,11 @@ const chicagoStyleTitleCase = require("chicago-capitalize");
5
5
const slugify = require ( "@sindresorhus/slugify" ) ;
6
6
const defaultFunction = ( commandName , option ) => ( str ) =>
7
7
_string [ commandName ] ( str , option ) ;
8
- const sequence = ( str ) => {
9
- let initial ;
8
+ const sequence = ( str , multiselectData = { } ) => {
10
9
return str . replace ( / - ? \d + / g, ( n ) => {
11
- const isFirst = typeof initial !== "number" ;
12
- initial = isFirst ? Number ( n ) : initial + 1 ;
13
- return initial ;
10
+ const isFirst = typeof multiselectData . offset !== "number" ;
11
+ multiselectData . offset = isFirst ? Number ( n ) : multiselectData . offset + 1 ;
12
+ return multiselectData . offset ;
14
13
} ) ;
15
14
} ;
16
15
const increment = ( str ) => str . replace ( / - ? \d + / g, ( n ) => Number ( n ) + 1 ) ;
@@ -75,6 +74,7 @@ const stringFunction = async (commandName, context) => {
75
74
const selectionMap = { } ;
76
75
if ( ! editor ) return ;
77
76
77
+ let multiselectData = { } ;
78
78
editor . selections . forEach ( async ( selection , index ) => {
79
79
const text = editor . document . getText ( selection ) ;
80
80
const textParts = text . split ( "\n" ) ;
@@ -87,7 +87,7 @@ const stringFunction = async (commandName, context) => {
87
87
. reduce ( ( prev , curr ) => prev . push ( stringFunc ( curr ) ) && prev , [ ] )
88
88
. join ( "\n" ) ;
89
89
} else if ( numberFunctionNames . includes ( commandName ) ) {
90
- replaced = commandNameFunctionMap [ commandName ] ( text ) ;
90
+ replaced = commandNameFunctionMap [ commandName ] ( text , multiselectData ) ;
91
91
} else {
92
92
stringFunc = commandNameFunctionMap [ commandName ] ;
93
93
replaced = textParts
0 commit comments