@@ -72,21 +72,21 @@ export function prevGrapheme(text: string, index: number) {
7272}
7373
7474export class Run extends RenderItem {
75- public start : number ;
76- public end : number ;
75+ public textStart : number ;
76+ public textEnd : number ;
7777
7878 static TEXT_BITS = Box . BITS . hasText
7979 | Box . BITS . hasForegroundInLayer
8080 | Box . BITS . hasForegroundInDescendent ;
8181
8282 constructor ( start : number , end : number , style : Style ) {
8383 super ( style ) ;
84- this . start = start ;
85- this . end = end ;
84+ this . textStart = start ;
85+ this . textEnd = end ;
8686 }
8787
8888 get length ( ) {
89- return this . end - this . start ;
89+ return this . textEnd - this . textStart ;
9090 }
9191
9292 getLogSymbol ( ) {
@@ -113,9 +113,9 @@ export class Run extends RenderItem {
113113 }
114114
115115 logName ( log : Logger , options ?: RenderItemLogOptions ) {
116- log . text ( `${ this . start } ,${ this . end } ` ) ;
116+ log . text ( `${ this . textStart } ,${ this . textEnd } ` ) ;
117117 if ( options ?. paragraphText ) {
118- log . text ( ` "${ loggableText ( options . paragraphText . slice ( this . start , this . end ) ) } "` ) ;
118+ log . text ( ` "${ loggableText ( options . paragraphText . slice ( this . textStart , this . textEnd ) ) } "` ) ;
119119 }
120120 }
121121
@@ -126,7 +126,7 @@ export class Run extends RenderItem {
126126 parent . bitfield |= Run . TEXT_BITS ;
127127 }
128128
129- for ( let i = this . start ; i < this . end ; i ++ ) {
129+ for ( let i = this . textStart ; i < this . textEnd ; i ++ ) {
130130 const code = paragraph . charCodeAt ( i ) ;
131131
132132 if ( code & NON_ASCII_MASK ) {
@@ -167,21 +167,21 @@ export function collapseWhitespace(ifc: IfcInline) {
167167
168168 if ( 'post' in item ) {
169169 const inline = item . post ;
170- inline . end -= delta ;
170+ inline . textEnd -= delta ;
171171 parents . pop ( ) ;
172172 } else if ( item . isInline ( ) ) {
173- item . start -= delta ;
173+ item . textStart -= delta ;
174174 parents . push ( item ) ;
175175 stack . push ( { post : item } ) ;
176176 for ( let i = item . children . length - 1 ; i >= 0 ; -- i ) stack . push ( item . children [ i ] ) ;
177177 } else if ( item . isRun ( ) ) {
178178 const whiteSpace = item . style . whiteSpace ;
179- const originalStart = item . start ;
179+ const originalStart = item . textStart ;
180180
181- item . start -= delta ;
181+ item . textStart -= delta ;
182182
183183 if ( whiteSpace === 'normal' || whiteSpace === 'nowrap' ) {
184- for ( let i = originalStart ; i < item . end ; i ++ ) {
184+ for ( let i = originalStart ; i < item . textEnd ; i ++ ) {
185185 const isWhitespace = isSpaceOrTabOrNewline ( ifc . text [ i ] ) ;
186186
187187 if ( inWhitespace && isWhitespace ) {
@@ -193,14 +193,14 @@ export function collapseWhitespace(ifc: IfcInline) {
193193 inWhitespace = isWhitespace ;
194194 }
195195 } else if ( whiteSpace === 'pre-line' ) {
196- for ( let i = originalStart ; i < item . end ; i ++ ) {
196+ for ( let i = originalStart ; i < item . textEnd ; i ++ ) {
197197 const isWhitespace = isSpaceOrTabOrNewline ( ifc . text [ i ] ) ;
198198
199199 if ( isWhitespace ) {
200200 let j = i + 1 ;
201201 let hasNewline = isNewline ( ifc . text [ i ] ) ;
202202
203- for ( ; j < item . end && isSpaceOrTabOrNewline ( ifc . text [ j ] ) ; j ++ ) {
203+ for ( ; j < item . textEnd && isSpaceOrTabOrNewline ( ifc . text [ j ] ) ; j ++ ) {
204204 hasNewline = hasNewline || isNewline ( ifc . text [ j ] ) ;
205205 }
206206
@@ -228,12 +228,12 @@ export function collapseWhitespace(ifc: IfcInline) {
228228 }
229229 } else { // pre
230230 inWhitespace = false ;
231- for ( let i = originalStart ; i < item . end ; i ++ ) {
231+ for ( let i = originalStart ; i < item . textEnd ; i ++ ) {
232232 str [ stri ++ ] = ifc . text . charCodeAt ( i ) ;
233233 }
234234 }
235235
236- item . end -= delta ;
236+ item . textEnd -= delta ;
237237
238238 if ( item . length === 0 ) {
239239 const parent = parents . at ( - 1 ) ! ;
@@ -247,7 +247,7 @@ export function collapseWhitespace(ifc: IfcInline) {
247247 }
248248
249249 ifc . text = decoder . decode ( str . subarray ( 0 , stri ) ) ;
250- ifc . end = ifc . text . length ;
250+ ifc . textEnd = ifc . text . length ;
251251}
252252
253253export interface ShapingAttrs {
@@ -603,10 +603,10 @@ export class ShapedItem implements IfcRenderItem {
603603 this . glyphs = leftGlyphs ;
604604 this . length = offset ;
605605 this . inlines = inlines . filter ( inline => {
606- return inline . start < this . end ( ) && inline . end > this . offset ;
606+ return inline . textStart < this . end ( ) && inline . textEnd > this . offset ;
607607 } ) ;
608608 right . inlines = inlines . filter ( inline => {
609- return inline . start < right . end ( ) && inline . end > right . offset ;
609+ return inline . textStart < right . end ( ) && inline . textEnd > right . offset ;
610610 } ) ;
611611
612612 for ( const i of right . inlines ) i . nshaped += 1 ;
@@ -2229,7 +2229,7 @@ export class Paragraph {
22292229
22302230 if ( mark . inlinePre ) {
22312231 candidates . height . pushInline ( mark . inlinePre ) ;
2232- if ( item && item . offset <= mark . inlinePre . start && item . end ( ) > mark . inlinePre . start ) {
2232+ if ( item && item . offset <= mark . inlinePre . textStart && item . end ( ) > mark . inlinePre . textStart ) {
22332233 candidates . height . stampMetrics ( getMetrics ( mark . inlinePre . style , item . face ) ) ;
22342234 }
22352235 parents . push ( mark . inlinePre ) ;
@@ -2574,7 +2574,7 @@ export class Paragraph {
25742574 const count = counts . get ( inline ) ;
25752575 const isFirstOccurance = count === undefined ;
25762576 const isOrthogonal = ( item . attrs . level & 1 ? 'rtl' : 'ltr' ) !== direction ;
2577- const mark = isOrthogonal ? inline . end : inline . start ;
2577+ const mark = isOrthogonal ? inline . textEnd : inline . textStart ;
25782578 const alignmentContext = linebox . contextRoots . get ( inline ) ;
25792579
25802580 bgcursor = x ;
@@ -2635,7 +2635,7 @@ export class Paragraph {
26352635 const count = counts . get ( inline ) ! ;
26362636 const isLastOccurance = count === inline . nshaped ;
26372637 const isOrthogonal = ( item . attrs . level & 1 ? 'rtl' : 'ltr' ) !== direction ;
2638- const mark = isOrthogonal ? inline . start : inline . end ;
2638+ const mark = isOrthogonal ? inline . textStart : inline . textEnd ;
26392639
26402640 bgcursor = x ;
26412641
0 commit comments