You are browsing as a guest. Sign up (or log in) to start making projects!

48m 17s logged

Syntax highlighting is here! Honestly thought this would take way longer than it did.

The approach is simple: walk through the string character by character, check
what type the next token is (keyword, variable, number, operator, bracket) and
set the color before printing. The actual characters are printed 1:1 so if there are 17 spaces there will be printed 17.

Color changes are handled by a prebuilt textColor(COLOUR); function that just
sets the console color before the next print. Clean and simple.

Known bugs I definitely know about and totally plan to fix (eventually):

– Can’t write mid-line because of a \0 at the start of the string 💀

– Pressing delete at the end of a line removes the entire line (is this a bug or a feature? I’m choosing to call it a feature for now)

Next up: fixing the actual bugs. Probably.

1
36

Comments 0

No comments yet. Be the first!