mirror of
https://git.adityakumar.xyz/llama.cpp.git
synced 2024-11-14 00:59:43 +00:00
Fix colors enabling on WIN32
This commit is contained in:
parent
79b2b266db
commit
c2b25b6912
1 changed files with 8 additions and 8 deletions
|
@ -46,14 +46,12 @@ static bool con_use_color = false;
|
||||||
|
|
||||||
void enable_console_colors() {
|
void enable_console_colors() {
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
if (params.use_color) {
|
|
||||||
// Enable ANSI colors on Windows 10+
|
// Enable ANSI colors on Windows 10+
|
||||||
unsigned long dwMode = 0;
|
unsigned long dwMode = 0;
|
||||||
void* hConOut = GetStdHandle((unsigned long)-11); // STD_OUTPUT_HANDLE (-11)
|
void* hConOut = GetStdHandle((unsigned long)-11); // STD_OUTPUT_HANDLE (-11)
|
||||||
if (hConOut && hConOut != (void*)-1 && GetConsoleMode(hConOut, &dwMode) && !(dwMode & 0x4)) {
|
if (hConOut && hConOut != (void*)-1 && GetConsoleMode(hConOut, &dwMode) && !(dwMode & 0x4)) {
|
||||||
SetConsoleMode(hConOut, dwMode | 0x4); // ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
|
SetConsoleMode(hConOut, dwMode | 0x4); // ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +285,9 @@ int main(int argc, char ** argv) {
|
||||||
int n_consumed = 0;
|
int n_consumed = 0;
|
||||||
|
|
||||||
// the first thing we will do is to output the prompt, so set color accordingly
|
// the first thing we will do is to output the prompt, so set color accordingly
|
||||||
|
if (params.use_color) {
|
||||||
enable_console_colors();
|
enable_console_colors();
|
||||||
|
}
|
||||||
set_console_state(CONSOLE_STATE_PROMPT);
|
set_console_state(CONSOLE_STATE_PROMPT);
|
||||||
|
|
||||||
std::vector<llama_token> embd;
|
std::vector<llama_token> embd;
|
||||||
|
|
Loading…
Reference in a new issue