diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2020-08-29 13:44:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-30 10:31:04 +0200 |
commit | c587db387c8edd27fc6ed9ed8c7bdbb6588e5264 (patch) | |
tree | 1bb3f98fe24a8a3d784e322b1415abbd7c93f2b1 /Applications | |
parent | db422fa49977ce7fdf08126488dc54e3393b3a43 (diff) | |
download | serenity-c587db387c8edd27fc6ed9ed8c7bdbb6588e5264.zip |
TextEditor: Don't try to move(lambda)
The move constructor of a lambda just copies it anyway.
Even if the first move() left an 'empty' closure behind, then
'm_editor->on_cursor_change' would only be able to see an empty
closure, which is certainly not what was intended.
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.cpp | 19 | ||||
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.h | 1 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp index a69a8797c9..75396a36d5 100644 --- a/Applications/TextEditor/TextEditorWidget.cpp +++ b/Applications/TextEditor/TextEditorWidget.cpp @@ -86,15 +86,9 @@ TextEditorWidget::TextEditorWidget() update_title(); }; - auto update_statusbar_cursor_position = [this] { - StringBuilder builder; - builder.appendf("Line: %d, Column: %d", m_editor->cursor().line() + 1, m_editor->cursor().column()); - m_statusbar->set_text(builder.to_string()); - }; - m_page_view = splitter.add<Web::InProcessWebView>(); m_page_view->set_visible(false); - m_page_view->on_link_hover = [this, update_statusbar_cursor_position = move(update_statusbar_cursor_position)](auto& url) { + m_page_view->on_link_hover = [this](auto& url) { if (url.is_valid()) m_statusbar->set_text(url.to_string()); else @@ -300,9 +294,7 @@ TextEditorWidget::TextEditorWidget() m_statusbar = add<GUI::StatusBar>(); - m_editor->on_cursor_change = [update_statusbar_cursor_position = move(update_statusbar_cursor_position)] { - update_statusbar_cursor_position(); - }; + m_editor->on_cursor_change = [this] { update_statusbar_cursor_position(); }; m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { if (m_document_dirty) { @@ -643,3 +635,10 @@ void TextEditorWidget::update_html_preview() m_page_view->load_html(m_editor->text(), URL::create_with_file_protocol(m_path)); m_page_view->scroll_into_view(current_scroll_pos, true, true); } + +void TextEditorWidget::update_statusbar_cursor_position() +{ + StringBuilder builder; + builder.appendf("Line: %d, Column: %d", m_editor->cursor().line() + 1, m_editor->cursor().column()); + m_statusbar->set_text(builder.to_string()); +} diff --git a/Applications/TextEditor/TextEditorWidget.h b/Applications/TextEditor/TextEditorWidget.h index 54be8fcff1..77da7c5eae 100644 --- a/Applications/TextEditor/TextEditorWidget.h +++ b/Applications/TextEditor/TextEditorWidget.h @@ -60,6 +60,7 @@ private: void update_preview(); void update_markdown_preview(); void update_html_preview(); + void update_statusbar_cursor_position(); virtual void drop_event(GUI::DropEvent&) override; |