diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 9b3a44a5b..524002d90 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -4761,10 +4761,18 @@ void UICodeEditor::drawLineEndings( const DocumentLineRange& lineRange, const Ve } void UICodeEditor::registerCommands() { - mDoc->setCommand( "move-to-previous-line", [this] { moveToPreviousLine(); } ); - mDoc->setCommand( "move-to-next-line", [this] { moveToNextLine(); } ); - mDoc->setCommand( "move-to-previous-page", [this] { moveToPreviousPage(); } ); - mDoc->setCommand( "move-to-next-page", [this] { moveToNextPage(); } ); + mDoc->setCommand( "move-to-previous-line", []( Client* client ) { + static_cast( client )->moveToPreviousLine(); + } ); + mDoc->setCommand( "move-to-next-line", []( Client* client ) { + static_cast( client )->moveToNextLine(); + } ); + mDoc->setCommand( "move-to-previous-page", []( Client* client ) { + static_cast( client )->moveToPreviousPage(); + } ); + mDoc->setCommand( "move-to-next-page", []( Client* client ) { + static_cast( client )->moveToNextPage(); + } ); mDoc->setCommand( "move-to-start-of-line", []( Client* client ) { static_cast( client )->moveToStartOfLine(); } ); @@ -4789,27 +4797,64 @@ void UICodeEditor::registerCommands() { mDoc->setCommand( "select-to-start-of-content", []( Client* client ) { static_cast( client )->selectToStartOfContent(); } ); - mDoc->setCommand( "move-scroll-up", [this] { moveScrollUp(); } ); - mDoc->setCommand( "move-scroll-down", [this] { moveScrollDown(); } ); - mDoc->setCommand( "jump-lines-up", [this] { jumpLinesUp(); } ); - mDoc->setCommand( "jump-lines-down", [this] { jumpLinesDown(); } ); - mDoc->setCommand( "indent", [this] { indent(); } ); - mDoc->setCommand( "unindent", [this] { unindent(); } ); - mDoc->setCommand( "copy", [this] { copy(); } ); - mDoc->setCommand( "cut", [this] { cut(); } ); - mDoc->setCommand( "paste", [this] { paste(); } ); - mDoc->setCommand( "font-size-grow", [this] { fontSizeGrow(); } ); - mDoc->setCommand( "font-size-shrink", [this] { fontSizeShrink(); } ); - mDoc->setCommand( "font-size-reset", [this] { fontSizeReset(); } ); - mDoc->setCommand( "lock", [this] { setLocked( true ); } ); - mDoc->setCommand( "unlock", [this] { setLocked( false ); } ); - mDoc->setCommand( "lock-toggle", [this] { setLocked( !isLocked() ); } ); - mDoc->setCommand( "open-containing-folder", [this] { openContainingFolder(); } ); - mDoc->setCommand( "copy-containing-folder-path", [this] { copyContainingFolderPath(); } ); - mDoc->setCommand( "copy-file-path", [this] { copyFilePath(); } ); - mDoc->setCommand( "copy-file-path-and-position", [this] { copyFilePath( true ); } ); - mDoc->setCommand( "find-replace", [this] { showFindReplace(); } ); - mDoc->setCommand( "open-context-menu", [this] { createContextMenu(); } ); + mDoc->setCommand( "move-scroll-up", []( Client* client ) { + static_cast( client )->moveScrollUp(); + } ); + mDoc->setCommand( "move-scroll-down", []( Client* client ) { + static_cast( client )->moveScrollDown(); + } ); + mDoc->setCommand( "jump-lines-up", []( Client* client ) { + static_cast( client )->jumpLinesUp(); + } ); + mDoc->setCommand( "jump-lines-down", []( Client* client ) { + static_cast( client )->jumpLinesDown(); + } ); + mDoc->setCommand( "indent", + []( Client* client ) { static_cast( client )->indent(); } ); + mDoc->setCommand( "unindent", + []( Client* client ) { static_cast( client )->unindent(); } ); + mDoc->setCommand( "copy", + []( Client* client ) { static_cast( client )->copy(); } ); + mDoc->setCommand( "cut", + []( Client* client ) { static_cast( client )->cut(); } ); + mDoc->setCommand( "paste", + []( Client* client ) { static_cast( client )->paste(); } ); + mDoc->setCommand( "font-size-grow", []( Client* client ) { + static_cast( client )->fontSizeGrow(); + } ); + mDoc->setCommand( "font-size-shrink", []( Client* client ) { + static_cast( client )->fontSizeShrink(); + } ); + mDoc->setCommand( "font-size-reset", []( Client* client ) { + static_cast( client )->fontSizeReset(); + } ); + mDoc->setCommand( + "lock", []( Client* client ) { static_cast( client )->setLocked( true ); } ); + mDoc->setCommand( "unlock", []( Client* client ) { + static_cast( client )->setLocked( false ); + } ); + mDoc->setCommand( "lock-toggle", []( Client* client ) { + UICodeEditor* editor = static_cast( client ); + editor->setLocked( !editor->isLocked() ); + } ); + mDoc->setCommand( "open-containing-folder", []( Client* client ) { + static_cast( client )->openContainingFolder(); + } ); + mDoc->setCommand( "copy-containing-folder-path", []( Client* client ) { + static_cast( client )->copyContainingFolderPath(); + } ); + mDoc->setCommand( "copy-file-path", []( Client* client ) { + static_cast( client )->copyFilePath(); + } ); + mDoc->setCommand( "copy-file-path-and-position", []( Client* client ) { + static_cast( client )->copyFilePath( true ); + } ); + mDoc->setCommand( "find-replace", []( Client* client ) { + static_cast( client )->showFindReplace(); + } ); + mDoc->setCommand( "open-context-menu", []( Client* client ) { + static_cast( client )->createContextMenu(); + } ); mDoc->setCommand( "add-cursor-at-mouse-position", []( Client* client ) { static_cast( client )->addCursorAtMousePosition(); } );