Re: [mpg123-devel] [PATCH] term_posix: Ignore escape sequences
Brought to you by:
sobukus
|
From: Thomas O. <tho...@or...> - 2025-10-20 07:50:09
|
Am Fri, 17 Oct 2025 20:10:13 -0500 (CDT) schrieb Peter Tirsek <pe...@ti...>: > I did a brief survey of special keys in the terminal emulators I have > easy access to, and I think all these escape sequences can be ignored > by discarding the leading escape character(s), then any occurrences of > the characters `[0123456789;O`, followed by a character not in that > list. Funny how long mpg123 could live without caring about the issue of escape sequences messing with the terminal control keys. We probably should just go with https://en.wikipedia.org/wiki/ANSI_escape_code and do some generic escape sequence slurping. It's not that many variants if one doesn't actually want to interpret them. I think it should be OK to write simple code to deal with that without relying on a proper terminal/curses library. > I've applied the patch below to my copy of mpg123 and it works for me. > I thought I'd share it upstream in case anyone else finds it useful. Thanks, something along that we should add. Regarding the approach: As it can be reasonably assumed that a control sequence comes in one go, I'd rather loop-read it right after the intro character without a global flag for being inside a sequence or not. Alrighty then, Thomas |