Skip to content

Commit 15dbf40

Browse files
committed
fine tune
1 parent f9c788c commit 15dbf40

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

web_src/js/components/RepoActionView.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ test('processConsoleLine', () => {
2626
expect(ansiLogToHTML('\x1b[1A\x1b[2K\rtest\r\x1b[1B\x1b[1A\x1b[2K')).toEqual('test');
2727

2828
// treat "\033[0K" and "\033[0J" (Erase display/line) as "\r", then it will be covered to "\n" finally.
29-
expect(ansiLogToHTML('a\x1b[0Kb\x1b[2Jc')).toEqual('a\nb\nc');
29+
expect(ansiLogToHTML('a\x1b[Kb\x1b[2Jc')).toEqual('a\nb\nc');
3030
});

web_src/js/components/RepoActionView.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ export function initRepositoryActionView() {
309309
310310
// some unhandled control sequences by AnsiToHTML
311311
// https://man7.org/linux/man-pages/man4/console_codes.4.html
312-
const ansiRegexpRemove = /\x1b\[\d[A-H]/g; // Move cursor, treat them as a no-op.
313-
const ansiRegexpNewLine = /\x1b\[\d[JK]/g; // Erase display/line, treat them as a Carrige Return
312+
const ansiRegexpRemove = /\x1b\[\d+[A-H]/g; // Move cursor, treat them as no-op.
313+
const ansiRegexpNewLine = /\x1b\[\d?[JK]/g; // Erase display/line, treat them as a Carriage Return
314314
315315
function ansiCleanControlSequences(line) {
316316
if (line.includes('\x1b')) {

0 commit comments

Comments
 (0)