summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorh-h-h-h <13482553+h-h-h-h@users.noreply.github.com>2023-10-03 20:16:15 +0200
committerGitHub <noreply@github.com>2023-10-03 21:16:15 +0300
commit8186242b6d67cf87ae179fb1a62f52fdf0e5c5eb (patch)
tree38c9d1d90d1e0989f1c6011abfc1e052b83e1d21 /examples
parentac2219fef34eb5b713c286c34c6e4162c39c8f3b (diff)
main : consistent prefix/suffix coloring (#3425)
* Typo * No `--in-prefix` coloring The `--in-prefix` text was inconsistently colored. Now, it's never colored, just like the `--in-suffix` text.
Diffstat (limited to 'examples')
-rw-r--r--examples/main/main.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index 7367ae36..775a5a20 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -670,7 +670,7 @@ int main(int argc, char ** argv) {
}
fflush(stdout);
}
- // reset color to default if we there is no pending user input
+ // reset color to default if there is no pending user input
if (input_echo && (int) embd_inp.size() == n_consumed) {
console::set_display(console::reset);
}
@@ -697,10 +697,8 @@ int main(int argc, char ** argv) {
if (last_output.find(antiprompt, search_start_pos) != std::string::npos) {
if (params.interactive) {
is_interacting = true;
- console::set_display(console::user_input);
}
is_antiprompt = true;
- fflush(stdout);
break;
}
}
@@ -724,8 +722,6 @@ int main(int argc, char ** argv) {
is_interacting = true;
printf("\n");
- console::set_display(console::user_input);
- fflush(stdout);
} else if (params.instruct) {
is_interacting = true;
}
@@ -750,6 +746,9 @@ int main(int argc, char ** argv) {
printf("%s", buffer.c_str());
}
+ // color user input only
+ console::set_display(console::user_input);
+
std::string line;
bool another_line = true;
do {