-
-
Notifications
You must be signed in to change notification settings - Fork 71
fixbug: format error on vscode-build.log #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
d30081b
f55c647
ff885fb
fc2b477
aeddf9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,13 @@ export class Terminal implements vscode.Disposable { | |
|
|
||
| var options = {"cwd": config.workingDirectory}; | ||
| if (withlog) { | ||
| options["env"] = {XMAKE_LOGFILE: this.logfile}; | ||
| options["env"] = { | ||
| XMAKE_LOGFILE: this.logfile, | ||
| XMAKE_COLORTERM: "nocolor", | ||
| COLORTERM: "nocolor", | ||
| NO_COLOR: "1", | ||
| CLICOLOR: "0" | ||
| }; | ||
|
Comment on lines
+60
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
58
to
+66
|
||
| } | ||
|
|
||
| const kind: vscode.TaskDefinition = { | ||
|
|
@@ -79,7 +85,13 @@ export class Terminal implements vscode.Disposable { | |
|
|
||
| var options = {"cwd": config.workingDirectory}; | ||
| if (withlog) { | ||
| options["env"] = {XMAKE_LOGFILE: this.logfile}; | ||
| options["env"] = { | ||
| XMAKE_LOGFILE: this.logfile, | ||
| XMAKE_COLORTERM: "nocolor", | ||
| COLORTERM: "nocolor", | ||
| NO_COLOR: "1", | ||
| CLICOLOR: "0" | ||
| }; | ||
|
Comment on lines
86
to
+94
|
||
| } | ||
|
|
||
| const kind: vscode.TaskDefinition = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,6 +114,23 @@ export function decodeBufferWithConfidence(buffer: Buffer): { encoding: string; | |||||||||||||||||||||||||||||||||||
| return { encoding: 'utf8-fallback', text: utf8Text }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Remove terminal control bytes so diagnostics parser gets stable plain text. | ||||||||||||||||||||||||||||||||||||
| export function sanitizeBuildLogText(text: string): string { | ||||||||||||||||||||||||||||||||||||
| let cleaned = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Strip ANSI escape sequences (e.g. colors, cursor controls). | ||||||||||||||||||||||||||||||||||||
| cleaned = cleaned.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g, ''); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Apply backspaces to avoid broken words from in-place terminal updates. | ||||||||||||||||||||||||||||||||||||
| while (/\x08/.test(cleaned)) { | ||||||||||||||||||||||||||||||||||||
| cleaned = cleaned.replace(/[^\n]\x08/g, '').replace(/\x08/g, ''); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+124
to
+127
|
||||||||||||||||||||||||||||||||||||
| // Apply backspaces to avoid broken words from in-place terminal updates. | |
| while (/\x08/.test(cleaned)) { | |
| cleaned = cleaned.replace(/[^\n]\x08/g, '').replace(/\x08/g, ''); | |
| } | |
| // Apply backspaces to avoid broken words from in-place terminal updates in a single pass. | |
| const resultChars: string[] = []; | |
| for (const ch of cleaned) { | |
| if (ch === '\x08') { | |
| // Simulate terminal backspace: delete previous char within the same line, if any. | |
| if (resultChars.length > 0 && resultChars[resultChars.length - 1] !== '\n') { | |
| resultChars.pop(); | |
| } | |
| continue; | |
| } | |
| resultChars.push(ch); | |
| } | |
| cleaned = resultChars.join(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个影响有点大,正常编译输出的颜色输出 也没了。很多用户还是需要的