aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorVal Kharitonov <mail@kharvd.com>2023-03-13 12:24:18 -0400
committerGitHub <noreply@github.com>2023-03-13 18:24:18 +0200
commit2a20f48efad692a8c2744f10c673bbdbe0c751b7 (patch)
treed9c33d26aec6cd6f626b78c123bd6656823f283d /main.cpp
parentd1f224712d78ab2cbb78777acfeb6739f660eb96 (diff)
Fix UTF-8 handling (including colors) (#79)
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 98ccde5..d068761 100644
--- a/main.cpp
+++ b/main.cpp
@@ -939,6 +939,11 @@ int main(int argc, char ** argv) {
break;
}
}
+
+ // reset color to default if we there is no pending user input
+ if (!input_noecho && params.use_color && embd_inp.size() == input_consumed) {
+ printf(ANSI_COLOR_RESET);
+ }
}
// display text
@@ -946,10 +951,6 @@ int main(int argc, char ** argv) {
for (auto id : embd) {
printf("%s", vocab.id_to_token[id].c_str());
}
- // reset color to default if we there is no pending user input
- if (params.use_color && embd_inp.size() <= input_consumed) {
- printf(ANSI_COLOR_RESET);
- }
fflush(stdout);
}