diff options
author | Nathaniel Case <this.is@nathanielca.se> | 2020-10-06 17:03:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 21:03:52 +0000 |
commit | 419295a74f2c2162c75046e15bba51e1db220960 (patch) | |
tree | 6ca16e15ba22c6dec68e8db50a76b69f2e325594 | |
parent | bc5ca2c243ed916b0f90050966cc074a783ce79b (diff) | |
download | vyos.vyos-419295a74f2c2162c75046e15bba51e1db220960.tar.gz vyos.vyos-419295a74f2c2162c75046e15bba51e1db220960.zip |
Update terminal ansi_re (#87)
Update terminal ansi_re
Reviewed-by: https://github.com/apps/ansible-zuul
-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: |