Buffer in outputter_t::term_puts

We were calling write() once for each character; buffer these instead.
This commit is contained in:
ridiculousfish 2020-12-05 17:26:37 -08:00
parent 3d0200a115
commit 5f131878a9

View file

@ -362,9 +362,12 @@ int outputter_t::term_puts(const char *str, int affcnt) {
// scoped_push will restore it.
scoped_lock locker{s_tputs_receiver_lock};
scoped_push<outputter_t *> push(&s_tputs_receiver, this);
s_tputs_receiver->begin_buffering();
// On some systems, tputs takes a char*, on others a const char*.
// Like tparm, we just cast it to unconst, that should work everywhere.
return tputs(const_cast<char *>(str), affcnt, tputs_writer);
int res = tputs(const_cast<char *>(str), affcnt, tputs_writer);
s_tputs_receiver->end_buffering();
return res;
}
/// Write a wide character to the outputter. This should only be used when writing characters from