Skip to content

Commit ef43356

Browse files
committed
rename Run's start/end to textStart/textEnd
1 parent 19d5559 commit ef43356

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/layout-text.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ export function prevGrapheme(text: string, index: number) {
7272
}
7373

7474
export 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) {
@@ -176,12 +176,12 @@ export function collapseWhitespace(ifc: IfcInline) {
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)!;

0 commit comments

Comments
 (0)