Skip to content

Commit

Permalink
fine tune
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Apr 1, 2023
1 parent f9c788c commit 15dbf40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web_src/js/components/RepoActionView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ test('processConsoleLine', () => {
expect(ansiLogToHTML('\x1b[1A\x1b[2K\rtest\r\x1b[1B\x1b[1A\x1b[2K')).toEqual('test');

// treat "\033[0K" and "\033[0J" (Erase display/line) as "\r", then it will be covered to "\n" finally.
expect(ansiLogToHTML('a\x1b[0Kb\x1b[2Jc')).toEqual('a\nb\nc');
expect(ansiLogToHTML('a\x1b[Kb\x1b[2Jc')).toEqual('a\nb\nc');
});
4 changes: 2 additions & 2 deletions web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ export function initRepositoryActionView() {
// some unhandled control sequences by AnsiToHTML
// https://man7.org/linux/man-pages/man4/console_codes.4.html
const ansiRegexpRemove = /\x1b\[\d[A-H]/g; // Move cursor, treat them as a no-op.
const ansiRegexpNewLine = /\x1b\[\d[JK]/g; // Erase display/line, treat them as a Carrige Return
const ansiRegexpRemove = /\x1b\[\d+[A-H]/g; // Move cursor, treat them as no-op.
const ansiRegexpNewLine = /\x1b\[\d?[JK]/g; // Erase display/line, treat them as a Carriage Return
function ansiCleanControlSequences(line) {
if (line.includes('\x1b')) {
Expand Down

0 comments on commit 15dbf40

Please sign in to comment.