mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
Everywhere: Remove unintentional partial stream reads and writes
This commit is contained in:
parent
26516ee160
commit
ae51c1821c
44 changed files with 109 additions and 192 deletions
|
@ -51,8 +51,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
// the suggestion list to fit in the prompt line.
|
||||
auto start = max_line_count - m_prompt_lines_at_suggestion_initiation;
|
||||
for (size_t i = start; i < max_line_count; ++i)
|
||||
// FIXME: This should write the entire span.
|
||||
TRY(stderr_stream->write_some("\n"sv.bytes()));
|
||||
TRY(stderr_stream->write_until_depleted("\n"sv.bytes()));
|
||||
lines_used += max_line_count;
|
||||
longest_suggestion_length = 0;
|
||||
}
|
||||
|
@ -100,8 +99,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
if (next_column > m_num_columns) {
|
||||
auto lines = (suggestion.text_view.length() + m_num_columns - 1) / m_num_columns;
|
||||
lines_used += lines;
|
||||
// FIXME: This should write the entire span.
|
||||
TRY(stderr_stream->write_some("\n"sv.bytes()));
|
||||
TRY(stderr_stream->write_until_depleted("\n"sv.bytes()));
|
||||
num_printed = 0;
|
||||
}
|
||||
|
||||
|
@ -117,13 +115,11 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
|
||||
if (spans_entire_line) {
|
||||
num_printed += m_num_columns;
|
||||
// FIXME: This should write the entire span.
|
||||
TRY(stderr_stream->write_some(suggestion.text_string.bytes()));
|
||||
TRY(stderr_stream->write_some(suggestion.display_trivia_string.bytes()));
|
||||
TRY(stderr_stream->write_until_depleted(suggestion.text_string.bytes()));
|
||||
TRY(stderr_stream->write_until_depleted(suggestion.display_trivia_string.bytes()));
|
||||
} else {
|
||||
auto field = DeprecatedString::formatted("{: <{}} {}", suggestion.text_string, longest_suggestion_byte_length_without_trivia, suggestion.display_trivia_string);
|
||||
// FIXME: This should write the entire span.
|
||||
TRY(stderr_stream->write_some(DeprecatedString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes()));
|
||||
TRY(stderr_stream->write_until_depleted(DeprecatedString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes()));
|
||||
num_printed += longest_suggestion_length + 2;
|
||||
}
|
||||
|
||||
|
@ -154,8 +150,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
|
||||
TRY(VT::move_absolute(m_origin_row + lines_used, m_num_columns - string.length() - 1, *stderr_stream));
|
||||
TRY(VT::apply_style({ Style::Background(Style::XtermColor::Green) }, *stderr_stream));
|
||||
// FIXME: This should write the entire span.
|
||||
TRY(stderr_stream->write_some(string.bytes()));
|
||||
TRY(stderr_stream->write_until_depleted(string.bytes()));
|
||||
TRY(VT::apply_style(Style::reset_style(), *stderr_stream));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue