mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:37:34 +00:00
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.
This commit is contained in:
parent
b2454888e8
commit
7ceeb74535
47 changed files with 108 additions and 102 deletions
|
@ -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())
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue