Skip to content

Commit 44c04be

Browse files
committed
Use stringbuf instead of ostringstream
1 parent e083e48 commit 44c04be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/utils/terminal_pager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void terminal_pager::maybe_grab_cout()
4949
if (!m_grabbed && termcolor::_internal::is_atty(std::cout))
5050
{
5151
// Should we do anything with cerr?
52-
m_cout_rdbuf = std::cout.rdbuf(m_oss.rdbuf());
52+
m_cout_rdbuf = std::cout.rdbuf(&m_stringbuf);
5353
m_grabbed = true;
5454
}
5555
}
@@ -173,7 +173,7 @@ void terminal_pager::show()
173173

174174
release_cout();
175175

176-
split_input_at_newlines(m_oss.view());
176+
split_input_at_newlines(m_stringbuf.view());
177177

178178
update_terminal_size();
179179
if (m_rows == 0 || m_lines.size() <= m_rows - 1)

src/utils/terminal_pager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class terminal_pager
5555

5656

5757
bool m_grabbed;
58-
std::ostringstream m_oss;
58+
std::stringbuf m_stringbuf;
5959
std::streambuf* m_cout_rdbuf;
6060
std::vector<std::string> m_lines;
6161
size_t m_rows, m_columns;

0 commit comments

Comments
 (0)