Skip to content

Commit

Permalink
Remove extra whitespace in the untitled editor label (#108039)
Browse files Browse the repository at this point in the history
  • Loading branch information
mixj93 authored Oct 6, 2020
1 parent c242bd7 commit a5f5df6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ export class UntitledTextEditorModel extends BaseTextEditorModel implements IUnt
// - cannot be only whitespace (so we trim())
// - cannot be only non-alphanumeric characters (so we run word definition regex over it)
// - cannot be longer than FIRST_LINE_MAX_TITLE_LENGTH
// - normalize multiple whitespaces to a single whitespace

let modelFirstWordsCandidate: string | undefined = undefined;

const firstLineText = this.textEditorModel?.getValueInRange({ startLineNumber: 1, endLineNumber: 1, startColumn: 1, endColumn: UntitledTextEditorModel.FIRST_LINE_NAME_MAX_LENGTH + 1 }).trim();
const firstLineText = this.textEditorModel?.getValueInRange({ startLineNumber: 1, endLineNumber: 1, startColumn: 1, endColumn: UntitledTextEditorModel.FIRST_LINE_NAME_MAX_LENGTH + 1 }).trim().replace(/\s+/g, ' ');
if (firstLineText && ensureValidWordDefinition().exec(firstLineText)) {
modelFirstWordsCandidate = firstLineText;
}
Expand Down

0 comments on commit a5f5df6

Please sign in to comment.