MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / set_display

Function set_display

common/console.cpp:140–159  ·  view source on GitHub ↗

Keep track of current display and only emit ANSI code if it changes

Source from the content-addressed store, hash-verified

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

Callers 5

cleanupFunction · 0.70
readline_advancedFunction · 0.70
readlineFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50

Calls 1

fprintfFunction · 0.85

Tested by

no test coverage detected