Skip to content

Commit ce3a963

Browse files
committed
💄
1 parent 57758d6 commit ce3a963

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,22 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
139139
}
140140
}
141141

142-
let classifier = this.classifier;
142+
const classifier = this.classifier;
143143
let lastBreakingOffset = 0; // Last 0-based offset in the lineText at which a break happened
144144
let breakingLengths: number[] = []; // The length of each broken-up line text
145145
let breakingLengthsIndex: number = 0; // The count of breaks already done
146146
let visibleColumn = 0; // Visible column since the beginning of the current line
147147
let niceBreakOffset = -1; // Last index of a character that indicates a break should happen before it (more desirable)
148148
let niceBreakVisibleColumn = 0; // visible column if a break were to be later introduced before `niceBreakOffset`
149-
let len = lineText.length;
149+
const len = lineText.length;
150150

151151
for (let i = 0; i < len; i++) {
152152
// At this point, there is a certainty that the character before `i` fits on the current line,
153153
// but the character at `i` might not fit
154154

155-
let charCode = lineText.charCodeAt(i);
156-
let charCodeIsTab = (charCode === CharCode.Tab);
157-
let charCodeClass = classifier.get(charCode);
155+
const charCode = lineText.charCodeAt(i);
156+
const charCodeIsTab = (charCode === CharCode.Tab);
157+
const charCodeClass = classifier.get(charCode);
158158

159159
if (strings.isLowSurrogate(charCode)/* && i + 1 < len */) {
160160
// A surrogate pair must always be considered as a single unit, so it is never to be broken
@@ -173,18 +173,14 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
173173

174174
// CJK breaking : before break
175175
if (charCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && i > 0) {
176-
let prevCode = lineText.charCodeAt(i - 1);
177-
let prevClass = classifier.get(prevCode);
176+
const prevClass = classifier.get(lineText.charCodeAt(i - 1));
178177
if (prevClass !== CharacterClass.BREAK_BEFORE) { // Kinsoku Shori: Don't break after a leading character, like an open bracket
179178
niceBreakOffset = i;
180179
niceBreakVisibleColumn = wrappedTextIndentVisibleColumn;
181180
}
182181
}
183182

184-
let charColumnSize = 1;
185-
if (strings.isFullWidthCharacter(charCode)) {
186-
charColumnSize = columnsForFullWidthChar;
187-
}
183+
const charColumnSize = strings.isFullWidthCharacter(charCode) ? columnsForFullWidthChar : 1;
188184

189185
// Advance visibleColumn with character at `i`
190186
visibleColumn = CharacterHardWrappingLineMapperFactory.nextVisibleColumn(visibleColumn, tabSize, charCodeIsTab, charColumnSize);
@@ -239,8 +235,7 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
239235

240236
// CJK breaking : after break
241237
if (charCodeClass === CharacterClass.BREAK_IDEOGRAPHIC && i < len - 1) {
242-
let nextCode = lineText.charCodeAt(i + 1);
243-
let nextClass = classifier.get(nextCode);
238+
const nextClass = classifier.get(lineText.charCodeAt(i + 1));
244239
if (nextClass !== CharacterClass.BREAK_AFTER) { // Kinsoku Shori: Don't break before a trailing character, like a period
245240
niceBreakOffset = i + 1;
246241
niceBreakVisibleColumn = wrappedTextIndentVisibleColumn;

0 commit comments

Comments
 (0)