mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:27:45 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -230,11 +230,11 @@ void Editor::get_terminal_size()
|
|||
m_num_lines = ws.ws_row;
|
||||
}
|
||||
|
||||
void Editor::add_to_history(DeprecatedString const& line)
|
||||
void Editor::add_to_history(ByteString const& line)
|
||||
{
|
||||
if (line.is_empty())
|
||||
return;
|
||||
DeprecatedString histcontrol = getenv("HISTCONTROL");
|
||||
ByteString histcontrol = getenv("HISTCONTROL");
|
||||
auto ignoredups = histcontrol == "ignoredups" || histcontrol == "ignoreboth";
|
||||
auto ignorespace = histcontrol == "ignorespace" || histcontrol == "ignoreboth";
|
||||
if (ignoredups && !m_history.is_empty() && line == m_history.last().entry)
|
||||
|
@ -270,7 +270,7 @@ ErrorOr<Vector<Editor::HistoryEntry>> Editor::try_load_history(StringView path)
|
|||
return history;
|
||||
}
|
||||
|
||||
bool Editor::load_history(DeprecatedString const& path)
|
||||
bool Editor::load_history(ByteString const& path)
|
||||
{
|
||||
auto history_or_error = try_load_history(path);
|
||||
if (history_or_error.is_error())
|
||||
|
@ -322,7 +322,7 @@ static void merge(It0&& begin0, It0 const& end0, It1&& begin1, It1 const& end1,
|
|||
}
|
||||
}
|
||||
|
||||
bool Editor::save_history(DeprecatedString const& path)
|
||||
bool Editor::save_history(ByteString const& path)
|
||||
{
|
||||
// Note: Use a dummy entry to simplify merging.
|
||||
Vector<HistoryEntry> final_history { { "", 0 } };
|
||||
|
@ -345,7 +345,7 @@ bool Editor::save_history(DeprecatedString const& path)
|
|||
// Skip the dummy entry:
|
||||
for (auto iter = final_history.begin() + 1; iter != final_history.end(); ++iter) {
|
||||
auto const& entry = *iter;
|
||||
auto buffer = DeprecatedString::formatted("{}::{}\n\n", entry.timestamp, entry.entry);
|
||||
auto buffer = ByteString::formatted("{}::{}\n\n", entry.timestamp, entry.entry);
|
||||
auto maybe_error = file->write_until_depleted(buffer.bytes());
|
||||
if (maybe_error.is_error())
|
||||
return false;
|
||||
|
@ -373,7 +373,7 @@ void Editor::insert(Utf32View const& string)
|
|||
insert(string.code_points()[i]);
|
||||
}
|
||||
|
||||
void Editor::insert(DeprecatedString const& string)
|
||||
void Editor::insert(ByteString const& string)
|
||||
{
|
||||
for (auto ch : Utf8View { string })
|
||||
insert(ch);
|
||||
|
@ -389,7 +389,7 @@ void Editor::insert(u32 const cp)
|
|||
{
|
||||
StringBuilder builder;
|
||||
builder.append(Utf32View(&cp, 1));
|
||||
auto str = builder.to_deprecated_string();
|
||||
auto str = builder.to_byte_string();
|
||||
if (m_pending_chars.try_append(str.characters(), str.length()).is_error())
|
||||
return;
|
||||
|
||||
|
@ -419,7 +419,7 @@ void Editor::register_key_input_callback(KeyBinding const& binding)
|
|||
return register_key_input_callback(binding.keys, move(internal_function));
|
||||
}
|
||||
|
||||
return register_key_input_callback(binding.keys, [binding = DeprecatedString(binding.binding)](auto& editor) {
|
||||
return register_key_input_callback(binding.keys, [binding = ByteString(binding.binding)](auto& editor) {
|
||||
editor.insert(binding);
|
||||
return false;
|
||||
});
|
||||
|
@ -703,7 +703,7 @@ ErrorOr<void> Editor::really_quit_event_loop()
|
|||
return {};
|
||||
}
|
||||
|
||||
auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString, Editor::Error>
|
||||
auto Editor::get_line(ByteString const& prompt) -> Result<ByteString, Editor::Error>
|
||||
{
|
||||
initialize();
|
||||
m_is_editing = true;
|
||||
|
@ -727,7 +727,7 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString
|
|||
}
|
||||
restore();
|
||||
if (line) {
|
||||
DeprecatedString result { line, (size_t)line_length, Chomp };
|
||||
ByteString result { line, (size_t)line_length, Chomp };
|
||||
free(line);
|
||||
return result;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString
|
|||
if (loop.exec() == Retry)
|
||||
return get_line(prompt);
|
||||
|
||||
return m_input_error.has_value() ? Result<DeprecatedString, Editor::Error> { m_input_error.value() } : Result<DeprecatedString, Editor::Error> { m_returned_line };
|
||||
return m_input_error.has_value() ? Result<ByteString, Editor::Error> { m_input_error.value() } : Result<ByteString, Editor::Error> { m_returned_line };
|
||||
}
|
||||
|
||||
ErrorOr<void> Editor::try_update_once()
|
||||
|
@ -944,7 +944,7 @@ ErrorOr<void> Editor::handle_read_event()
|
|||
case InputState::CSIExpectFinal: {
|
||||
m_state = m_previous_free_state;
|
||||
auto is_in_paste = m_state == InputState::Paste;
|
||||
for (auto& parameter : DeprecatedString::copy(csi_parameter_bytes).split(';')) {
|
||||
for (auto& parameter : ByteString::copy(csi_parameter_bytes).split(';')) {
|
||||
if (auto value = parameter.to_uint(); value.has_value())
|
||||
csi_parameters.append(value.value());
|
||||
else
|
||||
|
@ -1532,14 +1532,14 @@ ErrorOr<void> Editor::refresh_display()
|
|||
dbgln("Drawn Spans:");
|
||||
for (auto& sentry : m_drawn_spans.m_spans_starting) {
|
||||
for (auto& entry : sentry.value) {
|
||||
dbgln("{}-{}: {}", sentry.key, entry.key, entry.value.to_deprecated_string());
|
||||
dbgln("{}-{}: {}", sentry.key, entry.key, entry.value.to_byte_string());
|
||||
}
|
||||
}
|
||||
dbgln("==========================================================================");
|
||||
dbgln("Current Spans:");
|
||||
for (auto& sentry : m_current_spans.m_spans_starting) {
|
||||
for (auto& entry : sentry.value) {
|
||||
dbgln("{}-{}: {}", sentry.key, entry.key, entry.value.to_deprecated_string());
|
||||
dbgln("{}-{}: {}", sentry.key, entry.key, entry.value.to_byte_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ ErrorOr<void> Editor::reposition_cursor(Stream& stream, bool to_end)
|
|||
|
||||
ErrorOr<void> VT::move_absolute(u32 row, u32 col, Stream& stream)
|
||||
{
|
||||
return stream.write_until_depleted(DeprecatedString::formatted("\033[{};{}H", row, col).bytes());
|
||||
return stream.write_until_depleted(ByteString::formatted("\033[{};{}H", row, col).bytes());
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::move_relative(int row, int col, Stream& stream)
|
||||
|
@ -1630,9 +1630,9 @@ ErrorOr<void> VT::move_relative(int row, int col, Stream& stream)
|
|||
col = -col;
|
||||
|
||||
if (row > 0)
|
||||
TRY(stream.write_until_depleted(DeprecatedString::formatted("\033[{}{}", row, x_op).bytes()));
|
||||
TRY(stream.write_until_depleted(ByteString::formatted("\033[{}{}", row, x_op).bytes()));
|
||||
if (col > 0)
|
||||
TRY(stream.write_until_depleted(DeprecatedString::formatted("\033[{}{}", col, y_op).bytes()));
|
||||
TRY(stream.write_until_depleted(ByteString::formatted("\033[{}{}", col, y_op).bytes()));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -1662,36 +1662,36 @@ Style Editor::find_applicable_style(size_t offset) const
|
|||
return style;
|
||||
}
|
||||
|
||||
DeprecatedString Style::Background::to_vt_escape() const
|
||||
ByteString Style::Background::to_vt_escape() const
|
||||
{
|
||||
if (is_default())
|
||||
return "";
|
||||
|
||||
if (m_is_rgb) {
|
||||
return DeprecatedString::formatted("\e[48;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
|
||||
return ByteString::formatted("\e[48;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
|
||||
} else {
|
||||
return DeprecatedString::formatted("\e[{}m", (u8)m_xterm_color + 40);
|
||||
return ByteString::formatted("\e[{}m", (u8)m_xterm_color + 40);
|
||||
}
|
||||
}
|
||||
|
||||
DeprecatedString Style::Foreground::to_vt_escape() const
|
||||
ByteString Style::Foreground::to_vt_escape() const
|
||||
{
|
||||
if (is_default())
|
||||
return "";
|
||||
|
||||
if (m_is_rgb) {
|
||||
return DeprecatedString::formatted("\e[38;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
|
||||
return ByteString::formatted("\e[38;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
|
||||
} else {
|
||||
return DeprecatedString::formatted("\e[{}m", (u8)m_xterm_color + 30);
|
||||
return ByteString::formatted("\e[{}m", (u8)m_xterm_color + 30);
|
||||
}
|
||||
}
|
||||
|
||||
DeprecatedString Style::Hyperlink::to_vt_escape(bool starting) const
|
||||
ByteString Style::Hyperlink::to_vt_escape(bool starting) const
|
||||
{
|
||||
if (is_empty())
|
||||
return "";
|
||||
|
||||
return DeprecatedString::formatted("\e]8;;{}\e\\", starting ? m_link : DeprecatedString::empty());
|
||||
return ByteString::formatted("\e]8;;{}\e\\", starting ? m_link : ByteString::empty());
|
||||
}
|
||||
|
||||
void Style::unify_with(Style const& other, bool prefer_other)
|
||||
|
@ -1720,7 +1720,7 @@ void Style::unify_with(Style const& other, bool prefer_other)
|
|||
m_is_empty &= other.m_is_empty;
|
||||
}
|
||||
|
||||
DeprecatedString Style::to_deprecated_string() const
|
||||
ByteString Style::to_byte_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("Style { "sv);
|
||||
|
@ -1767,13 +1767,13 @@ DeprecatedString Style::to_deprecated_string() const
|
|||
|
||||
builder.append('}');
|
||||
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::apply_style(Style const& style, Stream& stream, bool is_starting)
|
||||
{
|
||||
if (is_starting) {
|
||||
TRY(stream.write_until_depleted(DeprecatedString::formatted("\033[{};{};{}m{}{}{}",
|
||||
TRY(stream.write_until_depleted(ByteString::formatted("\033[{};{};{}m{}{}{}",
|
||||
style.bold() ? 1 : 22,
|
||||
style.underline() ? 4 : 24,
|
||||
style.italic() ? 3 : 23,
|
||||
|
@ -1795,7 +1795,7 @@ ErrorOr<void> VT::clear_lines(size_t count_above, size_t count_below, Stream& st
|
|||
} else {
|
||||
// Go down count_below lines.
|
||||
if (count_below > 0)
|
||||
TRY(stream.write_until_depleted(DeprecatedString::formatted("\033[{}B", count_below).bytes()));
|
||||
TRY(stream.write_until_depleted(ByteString::formatted("\033[{}B", count_below).bytes()));
|
||||
// Then clear lines going upwards.
|
||||
for (size_t i = count_below + count_above; i > 0; --i) {
|
||||
TRY(stream.write_until_depleted("\033[2K"sv.bytes()));
|
||||
|
@ -2190,11 +2190,11 @@ Result<Vector<size_t, 2>, Editor::Error> Editor::vt_dsr()
|
|||
return Vector<size_t, 2> { row, col };
|
||||
}
|
||||
|
||||
DeprecatedString Editor::line(size_t up_to_index) const
|
||||
ByteString Editor::line(size_t up_to_index) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(Utf32View { m_buffer.data(), min(m_buffer.size(), up_to_index) });
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
void Editor::remove_at_index(size_t index)
|
||||
|
@ -2316,11 +2316,11 @@ bool Editor::Spans::contains_up_to_offset(Spans const& other, size_t offset) con
|
|||
if constexpr (LINE_EDITOR_DEBUG) {
|
||||
dbgln("Compare for {}-{} failed, no entry", entry.key, left_entry.key);
|
||||
for (auto& x : entry.value)
|
||||
dbgln("Have: {}-{} = {}", entry.key, x.key, x.value.to_deprecated_string());
|
||||
dbgln("Have: {}-{} = {}", entry.key, x.key, x.value.to_byte_string());
|
||||
}
|
||||
return false;
|
||||
} else if (value_it->value != left_entry.value) {
|
||||
dbgln_if(LINE_EDITOR_DEBUG, "Compare for {}-{} failed, different values: {} != {}", entry.key, left_entry.key, value_it->value.to_deprecated_string(), left_entry.value.to_deprecated_string());
|
||||
dbgln_if(LINE_EDITOR_DEBUG, "Compare for {}-{} failed, different values: {} != {}", entry.key, left_entry.key, value_it->value.to_byte_string(), left_entry.value.to_byte_string());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
|
@ -42,7 +42,7 @@ struct KeyBinding {
|
|||
InternalFunction,
|
||||
Insertion,
|
||||
} kind { Kind::InternalFunction };
|
||||
DeprecatedString binding;
|
||||
ByteString binding;
|
||||
};
|
||||
|
||||
struct Configuration {
|
||||
|
@ -67,7 +67,7 @@ struct Configuration {
|
|||
};
|
||||
|
||||
struct DefaultTextEditor {
|
||||
DeprecatedString command;
|
||||
ByteString command;
|
||||
};
|
||||
|
||||
Configuration()
|
||||
|
@ -97,7 +97,7 @@ struct Configuration {
|
|||
SignalHandler m_signal_mode { SignalHandler::WithSignalHandlers };
|
||||
OperationMode operation_mode { OperationMode::Unset };
|
||||
Vector<KeyBinding> keybindings;
|
||||
DeprecatedString m_default_text_editor {};
|
||||
ByteString m_default_text_editor {};
|
||||
bool enable_bracketed_paste { false };
|
||||
};
|
||||
|
||||
|
@ -144,15 +144,15 @@ public:
|
|||
|
||||
~Editor();
|
||||
|
||||
Result<DeprecatedString, Error> get_line(DeprecatedString const& prompt);
|
||||
Result<ByteString, Error> get_line(ByteString const& prompt);
|
||||
|
||||
void initialize();
|
||||
|
||||
void refetch_default_termios();
|
||||
|
||||
void add_to_history(DeprecatedString const& line);
|
||||
bool load_history(DeprecatedString const& path);
|
||||
bool save_history(DeprecatedString const& path);
|
||||
void add_to_history(ByteString const& line);
|
||||
bool load_history(ByteString const& path);
|
||||
bool save_history(ByteString const& path);
|
||||
auto const& history() const { return m_history; }
|
||||
bool is_history_dirty() const { return m_history_dirty; }
|
||||
|
||||
|
@ -194,11 +194,11 @@ public:
|
|||
}
|
||||
Vector<u32, 1024> const& buffer() const { return m_buffer; }
|
||||
u32 buffer_at(size_t pos) const { return m_buffer.at(pos); }
|
||||
DeprecatedString line() const { return line(m_buffer.size()); }
|
||||
DeprecatedString line(size_t up_to_index) const;
|
||||
ByteString line() const { return line(m_buffer.size()); }
|
||||
ByteString line(size_t up_to_index) const;
|
||||
|
||||
// Only makes sense inside a character_input callback or on_* callback.
|
||||
void set_prompt(DeprecatedString const& prompt)
|
||||
void set_prompt(ByteString const& prompt)
|
||||
{
|
||||
if (m_cached_prompt_valid)
|
||||
m_old_prompt_metrics = m_cached_prompt_metrics;
|
||||
|
@ -208,7 +208,7 @@ public:
|
|||
}
|
||||
|
||||
void clear_line();
|
||||
void insert(DeprecatedString const&);
|
||||
void insert(ByteString const&);
|
||||
void insert(StringView);
|
||||
void insert(Utf32View const&);
|
||||
void insert(const u32);
|
||||
|
@ -315,7 +315,7 @@ private:
|
|||
m_prompt_lines_at_suggestion_initiation = 0;
|
||||
m_refresh_needed = true;
|
||||
m_input_error.clear();
|
||||
m_returned_line = DeprecatedString::empty();
|
||||
m_returned_line = ByteString::empty();
|
||||
m_chars_touched_in_the_middle = 0;
|
||||
m_drawn_end_of_line_offset = 0;
|
||||
m_drawn_spans = {};
|
||||
|
@ -417,7 +417,7 @@ private:
|
|||
ByteBuffer m_pending_chars;
|
||||
Vector<char, 512> m_incomplete_data;
|
||||
Optional<Error> m_input_error;
|
||||
DeprecatedString m_returned_line;
|
||||
ByteString m_returned_line;
|
||||
|
||||
size_t m_cursor { 0 };
|
||||
size_t m_drawn_cursor { 0 };
|
||||
|
@ -444,7 +444,7 @@ private:
|
|||
OwnPtr<SuggestionDisplay> m_suggestion_display;
|
||||
Vector<u32, 32> m_remembered_suggestion_static_data;
|
||||
|
||||
DeprecatedString m_new_prompt;
|
||||
ByteString m_new_prompt;
|
||||
|
||||
SuggestionManager m_suggestion_manager;
|
||||
|
||||
|
@ -468,7 +468,7 @@ private:
|
|||
|
||||
// FIXME: This should be something more take_first()-friendly.
|
||||
struct HistoryEntry {
|
||||
DeprecatedString entry;
|
||||
ByteString entry;
|
||||
time_t timestamp;
|
||||
};
|
||||
Vector<HistoryEntry> m_history;
|
||||
|
|
|
@ -37,7 +37,7 @@ void Editor::search_forwards()
|
|||
ScopedValueRollback inline_search_cursor_rollback { m_inline_search_cursor };
|
||||
StringBuilder builder;
|
||||
builder.append(Utf32View { m_buffer.data(), m_inline_search_cursor });
|
||||
auto search_phrase = builder.to_deprecated_string();
|
||||
auto search_phrase = builder.to_byte_string();
|
||||
if (m_search_offset_state == SearchOffsetState::Backwards)
|
||||
--m_search_offset;
|
||||
if (m_search_offset > 0) {
|
||||
|
@ -64,7 +64,7 @@ void Editor::search_backwards()
|
|||
ScopedValueRollback inline_search_cursor_rollback { m_inline_search_cursor };
|
||||
StringBuilder builder;
|
||||
builder.append(Utf32View { m_buffer.data(), m_inline_search_cursor });
|
||||
auto search_phrase = builder.to_deprecated_string();
|
||||
auto search_phrase = builder.to_byte_string();
|
||||
if (m_search_offset_state == SearchOffsetState::Forwards)
|
||||
++m_search_offset;
|
||||
if (search(search_phrase, true)) {
|
||||
|
@ -257,7 +257,7 @@ void Editor::enter_search()
|
|||
|
||||
StringBuilder builder;
|
||||
builder.append(Utf32View { search_editor.buffer().data(), search_editor.buffer().size() });
|
||||
if (!search(builder.to_deprecated_string(), false, false)) {
|
||||
if (!search(builder.to_byte_string(), false, false)) {
|
||||
m_chars_touched_in_the_middle = m_buffer.size();
|
||||
m_refresh_needed = true;
|
||||
m_buffer.clear();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
: Color(r, g, b)
|
||||
{
|
||||
}
|
||||
DeprecatedString to_vt_escape() const;
|
||||
ByteString to_vt_escape() const;
|
||||
};
|
||||
|
||||
struct Foreground : public Color {
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString to_vt_escape() const;
|
||||
ByteString to_vt_escape() const;
|
||||
};
|
||||
|
||||
struct Hyperlink {
|
||||
|
@ -98,11 +98,11 @@ public:
|
|||
|
||||
Hyperlink() = default;
|
||||
|
||||
DeprecatedString to_vt_escape(bool starting) const;
|
||||
ByteString to_vt_escape(bool starting) const;
|
||||
|
||||
bool is_empty() const { return !m_has_link; }
|
||||
|
||||
DeprecatedString m_link;
|
||||
ByteString m_link;
|
||||
bool m_has_link { false };
|
||||
};
|
||||
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString replacement;
|
||||
ByteString replacement;
|
||||
mutable Utf8View replacement_view;
|
||||
Mode mode;
|
||||
};
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
bool is_anchored() const { return m_is_anchored; }
|
||||
bool is_empty() const { return m_is_empty; }
|
||||
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
ByteString to_byte_string() const;
|
||||
|
||||
private:
|
||||
bool m_underline { false };
|
||||
|
|
|
@ -106,7 +106,7 @@ SuggestionManager::CompletionAttemptResult SuggestionManager::attempt_completion
|
|||
result.avoid_committing_to_single_suggestion = true;
|
||||
m_last_shown_suggestion_display_length = 0;
|
||||
m_last_shown_suggestion_was_complete = false;
|
||||
m_last_shown_suggestion = DeprecatedString::empty();
|
||||
m_last_shown_suggestion = ByteString::empty();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ SuggestionManager::CompletionAttemptResult SuggestionManager::attempt_completion
|
|||
}
|
||||
result.new_completion_mode = CompletionMode::ShowSuggestions;
|
||||
m_last_shown_suggestion_was_complete = false;
|
||||
m_last_shown_suggestion = DeprecatedString::empty();
|
||||
m_last_shown_suggestion = ByteString::empty();
|
||||
} else {
|
||||
result.insert.append(suggestion.text_view().substring_view(suggestion.invariant_offset, suggestion.text_view().length() - suggestion.invariant_offset));
|
||||
// Add in the trivia of the last selected suggestion.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Utf32View.h>
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
static constexpr ForSearchTag ForSearch {};
|
||||
|
||||
// Intentionally not explicit. (To allow suggesting bare strings)
|
||||
CompletionSuggestion(DeprecatedString const& completion)
|
||||
CompletionSuggestion(ByteString const& completion)
|
||||
: CompletionSuggestion(completion, ""sv, {})
|
||||
{
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
|
||||
void reset()
|
||||
{
|
||||
m_last_shown_suggestion = DeprecatedString::empty();
|
||||
m_last_shown_suggestion = ByteString::empty();
|
||||
m_last_shown_suggestion_display_length = 0;
|
||||
m_suggestions.clear();
|
||||
m_last_displayed_suggestion_index = 0;
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
}
|
||||
|
||||
Vector<CompletionSuggestion> m_suggestions;
|
||||
CompletionSuggestion m_last_shown_suggestion { DeprecatedString::empty() };
|
||||
CompletionSuggestion m_last_shown_suggestion { ByteString::empty() };
|
||||
size_t m_last_shown_suggestion_display_length { 0 };
|
||||
bool m_last_shown_suggestion_was_complete { false };
|
||||
mutable size_t m_next_suggestion_index { 0 };
|
||||
|
|
|
@ -118,8 +118,8 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
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());
|
||||
TRY(stderr_stream->write_until_depleted(DeprecatedString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes()));
|
||||
auto field = ByteString::formatted("{: <{}} {}", suggestion.text_string(), longest_suggestion_byte_length_without_trivia, suggestion.display_trivia_string());
|
||||
TRY(stderr_stream->write_until_depleted(ByteString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes()));
|
||||
num_printed += longest_suggestion_length + 2;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager)
|
|||
if (m_pages.size() > 1) {
|
||||
auto left_arrow = page_index > 0 ? '<' : ' ';
|
||||
auto right_arrow = page_index < m_pages.size() - 1 ? '>' : ' ';
|
||||
auto string = DeprecatedString::formatted("{:c} page {} of {} {:c}", left_arrow, page_index + 1, m_pages.size(), right_arrow);
|
||||
auto string = ByteString::formatted("{:c} page {} of {} {:c}", left_arrow, page_index + 1, m_pages.size(), right_arrow);
|
||||
|
||||
if (string.length() > m_num_columns - 1) {
|
||||
// This would overflow into the next line, so just don't print an indicator.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue