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

Function set_display

smallthinker/common/console.cpp:143–162  ·  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

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)

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