mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
Fix removeAnsiEscapeCodes for escape sequence after : (#211886)
* Fix removeAnsiEscapeCodes for escape sequence after : Fix #209937 * And in debug-server-ready
This commit is contained in:
parent
2bdbf82fe7
commit
f8b115947e
|
@ -22,8 +22,8 @@ interface ServerReadyAction {
|
||||||
killOnServerStop?: boolean;
|
killOnServerStop?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Escape codes, compiled from https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_
|
// From src/vs/base/common/strings.ts
|
||||||
const CSI_SEQUENCE = /(:?\x1b\[|\x9B)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/g;
|
const CSI_SEQUENCE = /(?:(?:\x1b\[|\x9B)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~])|(:?\x1b\].*?\x07)/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Froms vs/base/common/strings.ts in core
|
* Froms vs/base/common/strings.ts in core
|
||||||
|
|
|
@ -766,7 +766,7 @@ export function lcut(text: string, n: number, prefix = '') {
|
||||||
|
|
||||||
// Escape codes, compiled from https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_
|
// Escape codes, compiled from https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_
|
||||||
// Plus additional markers for custom `\x1b]...\x07` instructions.
|
// Plus additional markers for custom `\x1b]...\x07` instructions.
|
||||||
const CSI_SEQUENCE = /(:?(:?\x1b\[|\x9B)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~])|(:?\x1b\].*?\x07)/g;
|
const CSI_SEQUENCE = /(?:(?:\x1b\[|\x9B)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~])|(:?\x1b\].*?\x07)/g;
|
||||||
|
|
||||||
/** Iterates over parts of a string with CSI sequences */
|
/** Iterates over parts of a string with CSI sequences */
|
||||||
export function* forAnsiStringParts(str: string) {
|
export function* forAnsiStringParts(str: string) {
|
||||||
|
|
|
@ -536,6 +536,11 @@ suite('Strings', () => {
|
||||||
`expect to forAnsiStringParts ${JSON.stringify(sequence)}`
|
`expect to forAnsiStringParts ${JSON.stringify(sequence)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #209937
|
||||||
|
assert.strictEqual(
|
||||||
|
strings.removeAnsiEscapeCodes(`localhost:\x1b[31m1234`),
|
||||||
|
'localhost:1234',);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('removeAnsiEscapeCodesFromPrompt', () => {
|
test('removeAnsiEscapeCodesFromPrompt', () => {
|
||||||
|
|
Loading…
Reference in a new issue