kopia lustrzana https://github.com/micropython/micropython-lib
aiorepl: Ignore duplicate LFLF after converting CRLF from Windows.
The regular REPL uses the uncooked input, but aiorepl reads from sys.stdin which is cooked. The result is that if the client sends a CRLF, aiorepl will see LFLF. This ignores a second LF in quick succession from the first. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>pull/571/head
rodzic
50b7aca171
commit
d6eb5b6f7e
|
@ -110,7 +110,12 @@ async def task(g=None, prompt="--> "):
|
|||
t = time.ticks_ms()
|
||||
if c < 0x20 or c > 0x7E:
|
||||
if c == 0x0A:
|
||||
# CR
|
||||
# LF
|
||||
# If the previous character was also LF, and was less
|
||||
# than 20 ms ago, this was likely due to CRLF->LFLF
|
||||
# conversion, so ignore this linefeed.
|
||||
if pc == 0x0A and time.ticks_diff(t, pt) < 20:
|
||||
continue
|
||||
sys.stdout.write("\n")
|
||||
if cmd:
|
||||
# Push current command.
|
||||
|
|
Ładowanie…
Reference in New Issue