@@ -69,12 +69,9 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
69
69
}
70
70
71
71
const overallWidth = Math . round ( firstLineBreakColumn * fontInfo . typicalHalfwidthCharacterWidth ) ;
72
-
73
- // Cannot respect WrappingIndent.Indent and WrappingIndent.DeepIndent because that would require
74
- // two dom layouts, in order to first set the width of the first line, and then set the width of the wrapped lines
75
- if ( wrappingIndent === WrappingIndent . Indent || wrappingIndent === WrappingIndent . DeepIndent ) {
76
- wrappingIndent = WrappingIndent . Same ;
77
- }
72
+ const additionalIndent = ( wrappingIndent === WrappingIndent . DeepIndent ? 2 : wrappingIndent === WrappingIndent . Indent ? 1 : 0 ) ;
73
+ const additionalIndentSize = Math . round ( tabSize * additionalIndent ) ;
74
+ const additionalIndentLength = Math . ceil ( fontInfo . spaceWidth * additionalIndentSize ) ;
78
75
79
76
const containerDomNode = document . createElement ( 'div' ) ;
80
77
Configuration . applyFontInfoSlow ( containerDomNode , fontInfo ) ;
@@ -123,7 +120,7 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
123
120
}
124
121
125
122
const renderLineContent = lineContent . substr ( firstNonWhitespaceIndex ) ;
126
- const tmp = renderLine ( renderLineContent , wrappedTextIndentLength , tabSize , width , sb ) ;
123
+ const tmp = renderLine ( renderLineContent , wrappedTextIndentLength , tabSize , width , sb , additionalIndentLength ) ;
127
124
firstNonWhitespaceIndices [ i ] = firstNonWhitespaceIndex ;
128
125
wrappedTextIndentLengths [ i ] = wrappedTextIndentLength ;
129
126
renderLineContents [ i ] = renderLineContent ;
@@ -152,7 +149,7 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
152
149
}
153
150
154
151
const firstNonWhitespaceIndex = firstNonWhitespaceIndices [ i ] ;
155
- const wrappedTextIndentLength = wrappedTextIndentLengths [ i ] ;
152
+ const wrappedTextIndentLength = wrappedTextIndentLengths [ i ] + additionalIndentSize ;
156
153
const visibleColumns = allVisibleColumns [ i ] ;
157
154
158
155
const breakOffsetsVisibleColumn : number [ ] = [ ] ;
@@ -189,8 +186,18 @@ const enum Constants {
189
186
SPAN_MODULO_LIMIT = 16384
190
187
}
191
188
192
- function renderLine ( lineContent : string , initialVisibleColumn : number , tabSize : number , width : number , sb : IStringBuilder ) : [ number [ ] , number [ ] ] {
193
- sb . appendASCIIString ( '<div style="width:' ) ;
189
+ function renderLine ( lineContent : string , initialVisibleColumn : number , tabSize : number , width : number , sb : IStringBuilder , wrappingIndentLength : number ) : [ number [ ] , number [ ] ] {
190
+
191
+ if ( wrappingIndentLength !== 0 ) {
192
+ let hangingOffset = String ( wrappingIndentLength ) ;
193
+ sb . appendASCIIString ( '<div style="text-indent: -' ) ;
194
+ sb . appendASCIIString ( hangingOffset ) ;
195
+ sb . appendASCIIString ( 'px; padding-left: ' ) ;
196
+ sb . appendASCIIString ( hangingOffset ) ;
197
+ sb . appendASCIIString ( 'px; box-sizing: border-box; width:' ) ;
198
+ } else {
199
+ sb . appendASCIIString ( '<div style="width:' ) ;
200
+ }
194
201
sb . appendASCIIString ( String ( width ) ) ;
195
202
sb . appendASCIIString ( 'px;">' ) ;
196
203
// if (containsRTL) {
0 commit comments