Skip to content

Commit 8186242

Browse files
authored
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.
1 parent ac2219f commit 8186242

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/main/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ int main(int argc, char ** argv) {
670670
}
671671
fflush(stdout);
672672
}
673-
// reset color to default if we there is no pending user input
673+
// reset color to default if there is no pending user input
674674
if (input_echo && (int) embd_inp.size() == n_consumed) {
675675
console::set_display(console::reset);
676676
}
@@ -697,10 +697,8 @@ int main(int argc, char ** argv) {
697697
if (last_output.find(antiprompt, search_start_pos) != std::string::npos) {
698698
if (params.interactive) {
699699
is_interacting = true;
700-
console::set_display(console::user_input);
701700
}
702701
is_antiprompt = true;
703-
fflush(stdout);
704702
break;
705703
}
706704
}
@@ -724,8 +722,6 @@ int main(int argc, char ** argv) {
724722

725723
is_interacting = true;
726724
printf("\n");
727-
console::set_display(console::user_input);
728-
fflush(stdout);
729725
} else if (params.instruct) {
730726
is_interacting = true;
731727
}
@@ -750,6 +746,9 @@ int main(int argc, char ** argv) {
750746
printf("%s", buffer.c_str());
751747
}
752748

749+
// color user input only
750+
console::set_display(console::user_input);
751+
753752
std::string line;
754753
bool another_line = true;
755754
do {

0 commit comments

Comments
 (0)