Keep track of current display and only emit ANSI code if it changes
| 141 | |
| 142 | // Keep track of current display and only emit ANSI code if it changes |
| 143 | void set_display(display_t display) { |
| 144 | if (advanced_display && current_display != display) { |
| 145 | fflush(stdout); |
| 146 | switch(display) { |
| 147 | case reset: |
| 148 | fprintf(out, ANSI_COLOR_RESET); |
| 149 | break; |
| 150 | case prompt: |
| 151 | fprintf(out, ANSI_COLOR_YELLOW); |
| 152 | break; |
| 153 | case user_input: |
| 154 | fprintf(out, ANSI_BOLD ANSI_COLOR_GREEN); |
| 155 | break; |
| 156 | case error: |
| 157 | fprintf(out, ANSI_BOLD ANSI_COLOR_RED); |
| 158 | } |
| 159 | current_display = display; |
| 160 | fflush(out); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | static char32_t getchar32() { |
| 165 | #if defined(_WIN32) |