From 49c52823b0c802e0fc8e4f18d517f766f7f43cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 19 Sep 2023 11:36:47 +0200 Subject: Fix backslashes "eating" their next character. Since we are working with literal characters, than a backslash shouldn't be removed when esacping a character. The current (and excpeted) functionallity is that the backslash should escape the next character, but print both. Also added tests for this. --- rainbow_parenthesis/__init__.py | 1 + 1 file changed, 1 insertion(+) (limited to 'rainbow_parenthesis/__init__.py') diff --git a/rainbow_parenthesis/__init__.py b/rainbow_parenthesis/__init__.py index 32b7493..1f5e2f7 100644 --- a/rainbow_parenthesis/__init__.py +++ b/rainbow_parenthesis/__init__.py @@ -112,6 +112,7 @@ def colorize(strm: io.TextIOBase) -> Generator[str | Colored, None, None]: in_string = '"' yield c case '\\': + yield c yield strm.read(1) case c: yield c -- cgit v1.2.3