Escape Seq. Unaffected by Regex Theme in Python

Hello,

Code not changing colour has pointed this out, escape sequences within Python strings are not affected by the theme. After making a custom theme, switching the language to Python, and creating a string using an escape sequence, ex) print("Hello,\nWorld!"), \n is not affected by the theme’s Regex color.

As @QwertyQwerty88 points out, this bug seems to affect some languages, Python included, so this should be a pretty simple fix if it works with other languages.

Thank you!

A suggestion if this does get fixed, the default Regex color should probably be a light pink or magenta, or at least some color that stands out from the default string color.

1 Like

Here’s a screenshot of it working, btw:

image

And I think this may be a weird codemirror thing so I wonder if they can fix this

1 Like

I remember this used to work, so I’d doubt CodeMirror would remove it for a couple of languages, but not all. Even if so, Replit is easily large enough to get CodeMirror’s attention to fix this, or Replit could even develop their own.

2 Likes

Here’s a screenshot of it failing to work in Python.

Apologies for the very high quality circles :laughing:

1 Like

Honestly I like the \n being colored differently from the rest of the string as it makes code more readily readable imo

3 Likes

Yes, especially in long print statements. It will be much easier to identify a line break and edit from there.

3 Likes

I’m confused by this: are you assuming that \n is a regular expression? (Just asking out of curiosity based on your very low color contrasting black circles)

3 Likes

Yea, I thought that \n was considered a regular expression, but I’m probably completely wrong. Regardless, it still should have a distinct color, especially for readability.

4 Likes

You are. It’s an escape sequence representing a newline. Regex only supports it, but it isn’t regex itself.

More on esc sequences here

4 Likes

Ah, sorry. I can’t believe I forgot those things are called escape sequences, I had done a Google search for clarity, and it did show them as Regex, the cause of my confusion. Thanks for the confirmation.

2 Likes

Like you said though, regardless of what it is, it should be consistently colored across all syntaxes supporting it. You might just want to change the title and OP tho to make it completely clear what your subject is.

Like Qwerty said, this might not be something Replit can fix. It might have to be put thru to Codemirror. I’m not sure if it has to be Codemirror who fixes it, but it’s just a point that I think may have to be taken into consideration

3 Likes

Yep, so if we get a reply saying this can’t be fixed on Replit’s end, I make an issue on their GitHub and hopefully someone can clear this up.

This is almost a year old, but the “bug” was fixed a while ago (I believe in a topic made by @NateDhaliwal?)

No, I thought you made it? Or maybe it was someone else who made it in which you replied.
Let me check my topics.

1 Like

Confirmed that I didn’t make it.
I believe another user did, and Replit Staff (Suzy, IIRC) replied and fixed the issue.

Found it:

Yeah, you just replied to it so I got confused

1 Like