summaryrefslogtreecommitdiff
path: root/Userland/Applications/TextEditor
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-05 23:04:31 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-06 00:27:30 +0430
commit51c2c69357963ecaffba522aa963a3eba1c3bc8e (patch)
tree0434ee07f49d5c0b1874f7477a82a7b084d2a790 /Userland/Applications/TextEditor
parent104dc93220861081cb1a95210c7f8fe0ddcff3e6 (diff)
downloadserenity-51c2c69357963ecaffba522aa963a3eba1c3bc8e.zip
AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
Diffstat (limited to 'Userland/Applications/TextEditor')
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index 31c8395acd..a62d824160 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -76,20 +76,20 @@ MainWidget::MainWidget()
m_replace_textbox->set_placeholder("Replace");
m_match_case_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("match_case_checkbox");
- m_match_case_checkbox->on_checked = [this] {
- m_match_case = m_match_case_checkbox->is_checked();
+ m_match_case_checkbox->on_checked = [this](auto is_checked) {
+ m_match_case = is_checked;
};
m_match_case_checkbox->set_checked(true);
m_regex_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("regex_checkbox");
- m_regex_checkbox->on_checked = [this] {
- m_use_regex = m_regex_checkbox->is_checked();
+ m_regex_checkbox->on_checked = [this](auto is_checked) {
+ m_use_regex = is_checked;
};
m_regex_checkbox->set_checked(false);
m_wrap_around_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("wrap_around_checkbox");
- m_wrap_around_checkbox->on_checked = [this] {
- m_should_wrap = m_wrap_around_checkbox->is_checked();
+ m_wrap_around_checkbox->on_checked = [this](auto is_checked) {
+ m_should_wrap = is_checked;
};
m_wrap_around_checkbox->set_checked(true);