@@ -77,11 +77,11 @@ function assertLineBreaks(factory: ILineBreaksComputerFactory, tabSize: number,
77
77
78
78
return lineBreakData ;
79
79
}
80
-
80
+ const wordBreakEditorOptionDefaultValue = EditorOptions . wordBreak . defaultValue ;
81
81
suite ( 'Editor ViewModel - MonospaceLineBreaksComputer' , ( ) => {
82
82
test ( 'MonospaceLineBreaksComputer' , ( ) => {
83
83
84
- const factory = new MonospaceLineBreaksComputerFactory ( '(' , '\t).' ) ;
84
+ const factory = new MonospaceLineBreaksComputerFactory ( '(' , '\t).' , wordBreakEditorOptionDefaultValue ) ;
85
85
86
86
// Empty string
87
87
assertLineBreaks ( factory , 4 , 5 , '' ) ;
@@ -160,7 +160,7 @@ suite('Editor ViewModel - MonospaceLineBreaksComputer', () => {
160
160
161
161
test ( 'MonospaceLineBreaksComputer incremental 1' , ( ) => {
162
162
163
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
163
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
164
164
165
165
assertIncrementalLineBreaks (
166
166
factory , 'just some text and more' , 4 ,
@@ -217,7 +217,7 @@ suite('Editor ViewModel - MonospaceLineBreaksComputer', () => {
217
217
} ) ;
218
218
219
219
test ( 'issue #95686: CRITICAL: loop forever on the monospaceLineBreaksComputer' , ( ) => {
220
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
220
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
221
221
assertIncrementalLineBreaks (
222
222
factory ,
223
223
' <tr dmx-class:table-danger="(alt <= 50)" dmx-class:table-warning="(alt <= 200)" dmx-class:table-primary="(alt <= 400)" dmx-class:table-info="(alt <= 800)" dmx-class:table-success="(alt >= 400)">' ,
@@ -229,7 +229,7 @@ suite('Editor ViewModel - MonospaceLineBreaksComputer', () => {
229
229
} ) ;
230
230
231
231
test ( 'issue #110392: Occasional crash when resize with panel on the right' , ( ) => {
232
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
232
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
233
233
assertIncrementalLineBreaks (
234
234
factory ,
235
235
'你好 **hello** **hello** **hello-world** hey there!' ,
@@ -242,7 +242,7 @@ suite('Editor ViewModel - MonospaceLineBreaksComputer', () => {
242
242
} ) ;
243
243
244
244
test ( 'MonospaceLineBreaksComputer - CJK and Kinsoku Shori' , ( ) => {
245
- const factory = new MonospaceLineBreaksComputerFactory ( '(' , '\t)' ) ;
245
+ const factory = new MonospaceLineBreaksComputerFactory ( '(' , '\t)' , wordBreakEditorOptionDefaultValue ) ;
246
246
assertLineBreaks ( factory , 4 , 5 , 'aa \u5b89|\u5b89' ) ;
247
247
assertLineBreaks ( factory , 4 , 5 , '\u3042 \u5b89|\u5b89' ) ;
248
248
assertLineBreaks ( factory , 4 , 5 , '\u3042\u3042|\u5b89\u5b89' ) ;
@@ -252,54 +252,64 @@ suite('Editor ViewModel - MonospaceLineBreaksComputer', () => {
252
252
} ) ;
253
253
254
254
test ( 'MonospaceLineBreaksComputer - WrappingIndent.Same' , ( ) => {
255
- const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' ) ;
255
+ const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' , wordBreakEditorOptionDefaultValue ) ;
256
256
assertLineBreaks ( factory , 4 , 38 , ' *123456789012345678901234567890123456|7890' , WrappingIndent . Same ) ;
257
257
} ) ;
258
258
259
259
test ( 'issue #16332: Scroll bar overlaying on top of text' , ( ) => {
260
- const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' ) ;
260
+ const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' , wordBreakEditorOptionDefaultValue ) ;
261
261
assertLineBreaks ( factory , 4 , 24 , 'a/ very/long/line/of/tex|t/that/expands/beyon|d/your/typical/line/|of/code/' , WrappingIndent . Indent ) ;
262
262
} ) ;
263
263
264
264
test ( 'issue #35162: wrappingIndent not consistently working' , ( ) => {
265
- const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' ) ;
265
+ const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' , wordBreakEditorOptionDefaultValue ) ;
266
266
const mapper = assertLineBreaks ( factory , 4 , 24 , ' t h i s |i s |a l |o n |g l |i n |e' , WrappingIndent . Indent ) ;
267
267
assert . strictEqual ( mapper ! . wrappedTextIndentLength , ' ' . length ) ;
268
268
} ) ;
269
269
270
270
test ( 'issue #75494: surrogate pairs' , ( ) => {
271
- const factory = new MonospaceLineBreaksComputerFactory ( '\t' , ' ' ) ;
271
+ const factory = new MonospaceLineBreaksComputerFactory ( '\t' , ' ' , wordBreakEditorOptionDefaultValue ) ;
272
272
assertLineBreaks ( factory , 4 , 49 , '🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼|🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼🐇👬🌖🌞🏇🍼|🐇👬' , WrappingIndent . Same ) ;
273
273
} ) ;
274
274
275
275
test ( 'issue #75494: surrogate pairs overrun 1' , ( ) => {
276
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
276
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
277
277
assertLineBreaks ( factory , 4 , 4 , '🐇👬|&|🌞🌖' , WrappingIndent . Same ) ;
278
278
} ) ;
279
279
280
280
test ( 'issue #75494: surrogate pairs overrun 2' , ( ) => {
281
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
281
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
282
282
assertLineBreaks ( factory , 4 , 17 , 'factory, |"xtxtfunc|(x"🌞🏇🍼🌞🏇🍼🐇|&👬🌖🌞👬🌖🌞🏇🍼|🐇👬x"' , WrappingIndent . Same ) ;
283
283
} ) ;
284
284
285
285
test ( 'MonospaceLineBreaksComputer - WrappingIndent.DeepIndent' , ( ) => {
286
- const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' ) ;
286
+ const factory = new MonospaceLineBreaksComputerFactory ( '' , '\t ' , wordBreakEditorOptionDefaultValue ) ;
287
287
const mapper = assertLineBreaks ( factory , 4 , 26 , ' W e A r e T e s t |i n g D e |e p I n d |e n t a t |i o n' , WrappingIndent . DeepIndent ) ;
288
288
assert . strictEqual ( mapper ! . wrappedTextIndentLength , ' ' . length ) ;
289
289
} ) ;
290
290
291
291
test ( 'issue #33366: Word wrap algorithm behaves differently around punctuation' , ( ) => {
292
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
292
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
293
293
assertLineBreaks ( factory , 4 , 23 , 'this is a line of |text, text that sits |on a line' , WrappingIndent . Same ) ;
294
294
} ) ;
295
295
296
296
test ( 'issue #152773: Word wrap algorithm behaves differently with bracket followed by comma' , ( ) => {
297
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
297
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
298
298
assertLineBreaks ( factory , 4 , 24 , 'this is a line of |(text), text that sits |on a line' , WrappingIndent . Same ) ;
299
299
} ) ;
300
300
301
301
test ( 'issue #112382: Word wrap doesn\'t work well with control characters' , ( ) => {
302
- const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue ) ;
302
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
303
303
assertLineBreaks ( factory , 4 , 6 , '\x06\x06\x06|\x06\x06\x06' , WrappingIndent . Same ) ;
304
304
} ) ;
305
+
306
+ test ( 'Word break work well with Chinese/Japanese/Korean (CJK) text when setting normal' , ( ) => {
307
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , wordBreakEditorOptionDefaultValue ) ;
308
+ assertLineBreaks ( factory , 4 , 5 , '你好|1111' , WrappingIndent . Same ) ;
309
+ } ) ;
310
+
311
+ test ( 'Word break work well with Chinese/Japanese/Korean (CJK) text when setting keepAll' , ( ) => {
312
+ const factory = new MonospaceLineBreaksComputerFactory ( EditorOptions . wordWrapBreakBeforeCharacters . defaultValue , EditorOptions . wordWrapBreakAfterCharacters . defaultValue , 'keepAll' ) ;
313
+ assertLineBreaks ( factory , 4 , 8 , '你好1111' , WrappingIndent . Same ) ;
314
+ } ) ;
305
315
} ) ;
0 commit comments