@@ -212,4 +212,72 @@ suite('WordPartOperations', () => {
212
212
const actual = serializePipePositions ( text , actualStops ) ;
213
213
assert . deepStrictEqual ( actual , EXPECTED ) ;
214
214
} ) ;
215
+
216
+ test ( 'issue #158667: cursorWordPartLeft stops at "-" even when "-" is not in word separators' , ( ) => {
217
+ const EXPECTED = [
218
+ '|this-|is-|a-|kebab-|case-|var| |THIS-|IS-|CAPS-|KEBAB| |this-|IS|Mixed|Use' ,
219
+ ] . join ( '\n' ) ;
220
+ const [ text , ] = deserializePipePositions ( EXPECTED ) ;
221
+ const actualStops = testRepeatedActionAndExtractPositions (
222
+ text ,
223
+ new Position ( 1000 , 1000 ) ,
224
+ ed => cursorWordPartLeft ( ed ) ,
225
+ ed => ed . getPosition ( ) ! ,
226
+ ed => ed . getPosition ( ) ! . equals ( new Position ( 1 , 1 ) ) ,
227
+ { wordSeparators : "!\"#&'()*+,./:;<=>?@[\\]^`{|}·" } // default characters sans '$-%~' plus '·'
228
+ ) ;
229
+ const actual = serializePipePositions ( text , actualStops ) ;
230
+ assert . deepStrictEqual ( actual , EXPECTED ) ;
231
+ } ) ;
232
+
233
+ test ( 'issue #158667: cursorWordPartRight stops at "-" even when "-" is not in word separators' , ( ) => {
234
+ const EXPECTED = [
235
+ 'this|-is|-a|-kebab|-case|-var| |THIS|-IS|-CAPS|-KEBAB| |this|-IS|Mixed|Use|' ,
236
+ ] . join ( '\n' ) ;
237
+ const [ text , ] = deserializePipePositions ( EXPECTED ) ;
238
+ const actualStops = testRepeatedActionAndExtractPositions (
239
+ text ,
240
+ new Position ( 1 , 1 ) ,
241
+ ed => cursorWordPartRight ( ed ) ,
242
+ ed => ed . getPosition ( ) ! ,
243
+ ed => ed . getPosition ( ) ! . equals ( new Position ( 1 , 60 ) ) ,
244
+ { wordSeparators : "!\"#&'()*+,./:;<=>?@[\\]^`{|}·" } // default characters sans '$-%~' plus '·'
245
+ ) ;
246
+ const actual = serializePipePositions ( text , actualStops ) ;
247
+ assert . deepStrictEqual ( actual , EXPECTED ) ;
248
+ } ) ;
249
+
250
+ test ( 'issue #158667: deleteWordPartLeft stops at "-" even when "-" is not in word separators' , ( ) => {
251
+ const EXPECTED = [
252
+ '|this-|is-|a-|kebab-|case-|var| |THIS-|IS-|CAPS-|KEBAB| |this-|IS|Mixed|Use' ,
253
+ ] . join ( ' ' ) ;
254
+ const [ text , ] = deserializePipePositions ( EXPECTED ) ;
255
+ const actualStops = testRepeatedActionAndExtractPositions (
256
+ text ,
257
+ new Position ( 1000 , 1000 ) ,
258
+ ed => deleteWordPartLeft ( ed ) ,
259
+ ed => ed . getPosition ( ) ! ,
260
+ ed => ed . getValue ( ) . length === 0 ,
261
+ { wordSeparators : "!\"#&'()*+,./:;<=>?@[\\]^`{|}·" } // default characters sans '$-%~' plus '·'
262
+ ) ;
263
+ const actual = serializePipePositions ( text , actualStops ) ;
264
+ assert . deepStrictEqual ( actual , EXPECTED ) ;
265
+ } ) ;
266
+
267
+ test ( 'issue #158667: deleteWordPartRight stops at "-" even when "-" is not in word separators' , ( ) => {
268
+ const EXPECTED = [
269
+ 'this|-is|-a|-kebab|-case|-var| |THIS|-IS|-CAPS|-KEBAB| |this|-IS|Mixed|Use|' ,
270
+ ] . join ( ' ' ) ;
271
+ const [ text , ] = deserializePipePositions ( EXPECTED ) ;
272
+ const actualStops = testRepeatedActionAndExtractPositions (
273
+ text ,
274
+ new Position ( 1 , 1 ) ,
275
+ ed => deleteWordPartRight ( ed ) ,
276
+ ed => new Position ( 1 , text . length - ed . getValue ( ) . length + 1 ) ,
277
+ ed => ed . getValue ( ) . length === 0 ,
278
+ { wordSeparators : "!\"#&'()*+,./:;<=>?@[\\]^`{|}·" } // default characters sans '$-%~' plus '·'
279
+ ) ;
280
+ const actual = serializePipePositions ( text , actualStops ) ;
281
+ assert . deepStrictEqual ( actual , EXPECTED ) ;
282
+ } ) ;
215
283
} ) ;
0 commit comments