I'm working on code for a serial terminal and I'm implementing the ANSI escape codes for moving around the cursor, clearing the screen, etc, and I am curious how to know which to use since there doesn't seem to be a clear stopping point for the codes.
I'm using https://www2.ccs.neu.edu/research/gpc/VonaUtils/vona/terminal/vtansi.htm as a reference
For example, if I receive the code,
I start reading characters, but if I get the value 75='K', that could be ESC[K = Erase End of Line, or a 75 as a count for a code like ESC[{COUNT=75}C for move cursor 75 columns right.
What if I was receiving the code to erase the line followed by a printed A? As far as I know the code for that and the cursor 75 cols right would receive the exact same sequence.
I'm probably missing something obvious but could someone please give me a hint? Thank you