summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorDexesTTP <dexes.ttp@gmail.com>2022-07-05 22:33:15 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-06 11:12:45 +0200
commit7ceeb745354e246ec91cbdcd6f17c8291c09aec0 (patch)
treeff0acc8f5603d392e0f0b82793df40b257e284ea /Userland/Applications
parentb2454888e8fa44775456536a2a71827763cba503 (diff)
downloadserenity-7ceeb745354e246ec91cbdcd6f17c8291c09aec0.zip
AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Browser/Tab.cpp2
-rw-r--r--Userland/Applications/HexEditor/FindDialog.cpp2
-rw-r--r--Userland/Applications/HexEditor/GoToOffsetDialog.cpp2
-rw-r--r--Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp2
-rw-r--r--Userland/Applications/Terminal/main.cpp2
-rw-r--r--Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index e17915f640..e6eb96325b 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -43,7 +43,7 @@ namespace Browser {
URL url_from_user_input(String const& input)
{
if (input.starts_with("?") && !g_search_engine.is_empty())
- return URL(g_search_engine.replace("{}", URL::percent_encode(input.substring_view(1))));
+ return URL(g_search_engine.replace("{}", URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly));
URL url_with_http_schema = URL(String::formatted("http://{}", input));
if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value())
diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp
index 6cd0e7c3d4..03b8b7fd1f 100644
--- a/Userland/Applications/HexEditor/FindDialog.cpp
+++ b/Userland/Applications/HexEditor/FindDialog.cpp
@@ -79,7 +79,7 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
}
case OPTION_HEX_VALUE: {
- auto decoded = decode_hex(text_value.replace(" ", "", true));
+ auto decoded = decode_hex(text_value.replace(" ", "", ReplaceMode::All));
if (decoded.is_error())
return String::formatted("Input is invalid: {}", decoded.error().string_literal());
diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp
index ea600cb0fc..f24428b14e 100644
--- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp
+++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp
@@ -128,7 +128,7 @@ GoToOffsetDialog::GoToOffsetDialog()
auto text = m_text_editor->text();
if (text.starts_with("0x")) {
m_offset_type_box->set_selected_index(1);
- m_text_editor->set_text(text.replace("0x", ""));
+ m_text_editor->set_text(text.replace("0x", "", ReplaceMode::FirstOnly));
}
update_statusbar();
};
diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
index 126f908e60..794f78ac04 100644
--- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
+++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
@@ -68,7 +68,7 @@ private:
while (iterator.has_next()) {
auto name = iterator.next_path();
- auto basename = name.replace(".json", "");
+ auto basename = name.replace(".json", "", ReplaceMode::FirstOnly);
if (!selected_keymaps.find(basename).is_end())
continue;
m_character_map_files.append(basename);
diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp
index bfe89e6fd2..110f0a6487 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -189,7 +189,7 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
find_textbox->set_fixed_width(230);
find_textbox->set_focus(true);
if (terminal.has_selection())
- find_textbox->set_text(terminal.selected_text().replace("\n", " ", true));
+ find_textbox->set_text(terminal.selected_text().replace("\n", " ", ReplaceMode::All));
auto find_backwards = TRY(find->try_add<GUI::Button>());
find_backwards->set_fixed_width(25);
find_backwards->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors());
diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
index 6b8b220e3d..a2d6f388d8 100644
--- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
+++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
@@ -124,7 +124,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget()
Core::DirIterator iterator("/res/terminal-colors", Core::DirIterator::SkipParentAndBaseDir);
while (iterator.has_next()) {
auto path = iterator.next_path();
- color_scheme_names.append(path.replace(".ini", ""));
+ color_scheme_names.append(path.replace(".ini", "", ReplaceMode::FirstOnly));
}
quick_sort(color_scheme_names);
auto& color_scheme_combo = *find_descendant_of_type_named<GUI::ComboBox>("color_scheme_combo");