summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-11 00:55:02 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (patch)
treeca64ba25aa735d25013d76c6d83570496c742014 /Userland/Libraries/LibLine
parentad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff)
downloadserenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibLine')
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp8
-rw-r--r--Userland/Libraries/LibLine/Editor.h10
-rw-r--r--Userland/Libraries/LibLine/InternalFunctions.cpp2
-rw-r--r--Userland/Libraries/LibLine/Style.h2
-rw-r--r--Userland/Libraries/LibLine/SuggestionManager.cpp2
-rw-r--r--Userland/Libraries/LibLine/SuggestionManager.h4
6 files changed, 14 insertions, 14 deletions
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 1969aed99a..8d3bf9a331 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -36,7 +36,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; }
namespace Line {
-Configuration Configuration::from_config(const StringView& libname)
+Configuration Configuration::from_config(StringView libname)
{
Configuration configuration;
auto config_file = Core::ConfigFile::open_for_lib(libname);
@@ -359,7 +359,7 @@ void Editor::insert(const String& string)
insert(ch);
}
-void Editor::insert(const StringView& string_view)
+void Editor::insert(StringView string_view)
{
for (auto ch : Utf8View { string_view })
insert(ch);
@@ -1190,7 +1190,7 @@ void Editor::cleanup_suggestions()
m_times_tab_pressed = 0; // Safe to say if we get here, the user didn't press TAB
}
-bool Editor::search(const StringView& phrase, bool allow_empty, bool from_beginning)
+bool Editor::search(StringView phrase, bool allow_empty, bool from_beginning)
{
int last_matching_offset = -1;
bool found = false;
@@ -1690,7 +1690,7 @@ void VT::clear_to_end_of_line(OutputStream& stream)
stream.write("\033[K"sv.bytes());
}
-StringMetrics Editor::actual_rendered_string_metrics(const StringView& string)
+StringMetrics Editor::actual_rendered_string_metrics(StringView string)
{
StringMetrics metrics;
StringMetrics::LineMetrics current_line;
diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h
index c4aa22fab7..ee7e237722 100644
--- a/Userland/Libraries/LibLine/Editor.h
+++ b/Userland/Libraries/LibLine/Editor.h
@@ -90,7 +90,7 @@ struct Configuration {
enable_bracketed_paste = flags & Flags::BracketedPaste;
}
- static Configuration from_config(const StringView& libname = "line");
+ static Configuration from_config(StringView libname = "line");
RefreshBehavior refresh_behavior { RefreshBehavior::Lazy };
SignalHandler m_signal_mode { SignalHandler::WithSignalHandlers };
@@ -159,14 +159,14 @@ public:
void register_key_input_callback(Vector<Key> keys, Function<bool(Editor&)> callback) { m_callback_machine.register_key_input_callback(move(keys), move(callback)); }
void register_key_input_callback(Key key, Function<bool(Editor&)> callback) { register_key_input_callback(Vector<Key> { key }, move(callback)); }
- static StringMetrics actual_rendered_string_metrics(const StringView&);
+ static StringMetrics actual_rendered_string_metrics(StringView);
static StringMetrics actual_rendered_string_metrics(const Utf32View&);
Function<Vector<CompletionSuggestion>(const Editor&)> on_tab_complete;
Function<void()> on_interrupt_handled;
Function<void(Editor&)> on_display_refresh;
- static Function<bool(Editor&)> find_internal_function(const StringView& name);
+ static Function<bool(Editor&)> find_internal_function(StringView name);
enum class CaseChangeOp {
Lowercase,
Uppercase,
@@ -207,7 +207,7 @@ public:
void clear_line();
void insert(const String&);
- void insert(const StringView&);
+ void insert(StringView);
void insert(const Utf32View&);
void insert(const u32);
void stylize(const Span&, const Style&);
@@ -282,7 +282,7 @@ private:
Style find_applicable_style(size_t offset) const;
- bool search(const StringView&, bool allow_empty = false, bool from_beginning = true);
+ bool search(StringView, bool allow_empty = false, bool from_beginning = true);
inline void end_search()
{
m_is_searching = false;
diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp
index 3eb981464e..00c39badeb 100644
--- a/Userland/Libraries/LibLine/InternalFunctions.cpp
+++ b/Userland/Libraries/LibLine/InternalFunctions.cpp
@@ -22,7 +22,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; }
namespace Line {
-Function<bool(Editor&)> Editor::find_internal_function(const StringView& name)
+Function<bool(Editor&)> Editor::find_internal_function(StringView name)
{
#define __ENUMERATE(internal_name) \
if (name == #internal_name) \
diff --git a/Userland/Libraries/LibLine/Style.h b/Userland/Libraries/LibLine/Style.h
index 1fc113eb52..d5099e46fd 100644
--- a/Userland/Libraries/LibLine/Style.h
+++ b/Userland/Libraries/LibLine/Style.h
@@ -90,7 +90,7 @@ public:
struct Hyperlink {
bool operator==(const Hyperlink&) const = default;
- explicit Hyperlink(const StringView& link)
+ explicit Hyperlink(StringView link)
: m_link(link)
{
m_has_link = true;
diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp
index 6f0d5a5b57..89d51c5101 100644
--- a/Userland/Libraries/LibLine/SuggestionManager.cpp
+++ b/Userland/Libraries/LibLine/SuggestionManager.cpp
@@ -9,7 +9,7 @@
namespace Line {
-CompletionSuggestion::CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style)
+CompletionSuggestion::CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style)
: style(style)
, text_string(completion)
, is_valid(true)
diff --git a/Userland/Libraries/LibLine/SuggestionManager.h b/Userland/Libraries/LibLine/SuggestionManager.h
index d9ef339e77..89fa9dafe0 100644
--- a/Userland/Libraries/LibLine/SuggestionManager.h
+++ b/Userland/Libraries/LibLine/SuggestionManager.h
@@ -36,12 +36,12 @@ public:
{
}
- CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia)
+ CompletionSuggestion(StringView completion, StringView trailing_trivia)
: CompletionSuggestion(completion, trailing_trivia, {})
{
}
- CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style);
+ CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style);
bool operator==(const CompletionSuggestion& suggestion) const
{