diff options
-rw-r--r-- | changelogs/fragments/terminal-escape-codes.yaml | 3 | ||||
-rw-r--r-- | plugins/terminal/vyos.py | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/changelogs/fragments/terminal-escape-codes.yaml b/changelogs/fragments/terminal-escape-codes.yaml new file mode 100644 index 0000000..7527dc4 --- /dev/null +++ b/changelogs/fragments/terminal-escape-codes.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - terminal plugin - Overhaul ansi_re to remove more escape sequences diff --git a/plugins/terminal/vyos.py b/plugins/terminal/vyos.py index 6f5fc76..a659002 100644 --- a/plugins/terminal/vyos.py +++ b/plugins/terminal/vyos.py @@ -40,10 +40,17 @@ class TerminalModule(TerminalBase): re.compile(br"\n\s+Set failed"), ] - ansi_re = [ - re.compile(br"\x1b\[\?1h\x1b="), # CSI ? 1 h ESC = - re.compile(br"\x08."), # [Backspace] . - re.compile(br"\x1b\[m"), # ANSI reset code + ansi_re = TerminalBase.ansi_re + [ + # Color codes + re.compile(br"\x1b\[(\d+(;\d+)*)?m"), + # Clear line (CSI K) + re.compile(br"\x1b\[K"), + # Xterm change cursor mode (CSI ? 1 [h|l]) + re.compile(br"\x1b\[\?1(h|l)"), + # Xterm change keypad (ESC [=|>]) + re.compile(br"\x1b(=|>)"), + # Xterm window title string (OSC <title string> BEL) + re.compile(br"\x1b]0;[^\x07]*\x07"), ] try: |