cimplec/sim-c

Errors during compilation result terminal text changing color to RED

Chasmiccoder opened this issue · 4 comments

Decription of the Bug
When a .simc file successfully gets compiled to form its respective .c file, the terminal text color changes to GREEN.
When the compiler encounters an error, it turns the terminal text color to RED. This behaviour is seen when the instructions
are carried out via VS Code's inbuilt terminal. When we try this in cmd, this error is not there.

Steps to Reproduce the Bug

  1. Create a .simc file (for example, test.simc), and write code written in high level language (as usual)
  2. Navigate to the folder in which test.simc is present (in the terminal. This error is apprearing in VS Code's inbuilt terminal)
  3. Type the command used to convert test.simc to test.c (command: simc test.simc )
  4. If the compilation is successful, it turns the output text green.
  5. The problem is that it turns the rest of the terminal text to green as well.
  6. Similarly, if the compiler encounters an error, it turns the text RED.

Note: My OS is Windows 10, and this error is appearing when I use VS Code's inbuilt terminal.

Expected behavior
Before the final output is printed in the terminal, the color needs to be changed (to red or green as needed). Then, the text
should be printed. Then, the terminal text should be changed back to its default (what it was before the output got printed).
So if the terminal text was white, after the output is printed, it should be turned back to white.

Screenshots
Done via VS Code's Terminal:
image

image

image

When done via cmd:
image

Desktop
Windows 10

Additional context
This error could be VS Code specific, and might be a bug in VS Code itself. I am not sure.

I suggest to resolve this printing "\e[m\n" at end execution, if the colors are produced by printing ASCII values at begging of string.

@Math-O5 I think it should be, \033[m. Refer to this:- https://www.instructables.com/Printing-Colored-Text-in-Python-Without-Any-Module/

@frankhart2018 Sorry, I forgot ask for the task.

No issues :)