diff --git a/include/eepp/ui/uicodeeditor.hpp b/include/eepp/ui/uicodeeditor.hpp index 0e34e05f9..4fee487eb 100644 --- a/include/eepp/ui/uicodeeditor.hpp +++ b/include/eepp/ui/uicodeeditor.hpp @@ -720,6 +720,8 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client { void setFoldsRefreshTime( const Time& foldsRefreshTime ); + void updateMouseCursor( const Vector2f& position ); + protected: struct LastXOffset { TextPosition position{ 0, 0 }; @@ -1035,8 +1037,6 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client { void findRegionsDelayed(); void refreshTag(); - - void updateMouseCursor( const Vector2f& position ); }; }} // namespace EE::UI diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index da7eef32d..77b75c489 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -116,7 +116,7 @@ {388e5431-b31b-42b3-b9ad-9002d279d75d} 10 0 - 8 + 19 ../../make/linux @@ -235,7 +235,7 @@ true - --with-debug-symbols gmake + --with-debug-symbols --with-text-shaper gmake premake4 %{buildDir}../../../ ProjectExplorer.ProcessStep @@ -1564,9 +1564,98 @@ 29 + + ProjectExplorer.Project.Target.1 + + Desktop + Python 2.7.18 + Python 2.7.18 + {2a67c17f-0b20-4f13-b20e-78e54b4ce738} + 0 + 0 + 0 + + /home/programming/eepp/projects/linux + + + + all + + true + GenericProjectManager.GenericMakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + GenericProjectManager.GenericMakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Default + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + false + false + false + /usr/bin/kcachegrind + 2 + 2 + true + true + /usr/bin/valgrind + + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + true + + 1 + + ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 93bb3b7eb..e0c0b036c 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -4808,9 +4808,12 @@ void UICodeEditor::refreshTag() { } void UICodeEditor::updateMouseCursor( const Vector2f& position ) { - bool overGutter = convertToNodeSpace( position ).x < getGutterWidth(); - getUISceneNode()->setCursor( - mHandShown ? Cursor::Hand : ( !overGutter && !mLocked ? Cursor::IBeam : Cursor::Arrow ) ); + if ( getScreenBounds().contains( position ) ) { + bool overGutter = convertToNodeSpace( position ).x < getGutterWidth(); + getUISceneNode()->setCursor( + mHandShown ? Cursor::Hand + : ( !overGutter && !mLocked ? Cursor::IBeam : Cursor::Arrow ) ); + } } }} // namespace EE::UI diff --git a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp index 6c42bcc7a..7f71550eb 100644 --- a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp +++ b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include using namespace EE::Graphics; @@ -1209,8 +1210,11 @@ void AutoCompletePlugin::resetSuggestions( UICodeEditor* editor ) { mSuggestionsEditor = nullptr; } mSuggestions.clear(); - if ( editor && editor->hasFocus() ) - editor->getUISceneNode()->setCursor( !editor->isLocked() ? Cursor::IBeam : Cursor::Arrow ); + if ( editor && editor->hasFocus() ) { + auto mousePos( editor->getUISceneNode()->getUIEventDispatcher()->getMousePosf() ); + if ( editor->getScreenRect().contains( mousePos ) ) + editor->updateMouseCursor( mousePos ); + } } void AutoCompletePlugin::resetSignatureHelp() { diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index 86fd53b18..e1bd848b5 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -998,6 +998,11 @@ SyntaxStyleType LinterPlugin::getMatchString( const LinterType& type ) { return "error"_sst; } +void LinterPlugin::preDraw( UICodeEditor*, const Vector2f& /*startScroll*/, + const Float& /*lineHeight*/, const TextPosition& /*cursor*/ ) { + mQuickFixRect = {}; +} + void LinterPlugin::drawAfterLineText( UICodeEditor* editor, const Int64& index, Vector2f position, const Float& /*fontSize*/, const Float& lineHeight ) { Lock l( mMatchesMutex ); @@ -1057,24 +1062,30 @@ void LinterPlugin::drawAfterLineText( UICodeEditor* editor, const Int64& index, Float rLineWidth = 0; - if ( !quickFixRendered && doc->getSelection().start().line() == index && - !match.diagnostic.codeActions.empty() ) { - rLineWidth = editor->getLineWidth( index ) + editor->getGlyphWidth(); - Color wcolor( editor->getColorScheme().getEditorSyntaxStyle( "warning"_sst ).color ); - if ( nullptr == mLightbulbIcon ) { - mLightbulbIcon = editor->getUISceneNode()->getUIIconThemeManager()->findIcon( - "lightbulb-autofix" ); - } - if ( nullptr != mLightbulbIcon ) { - Drawable* drawable = mLightbulbIcon->getSize( (int)eefloor( lineHeight ) ); - if ( drawable == nullptr ) - return; + if ( !quickFixRendered && doc->getSelection().start().line() == index ) { + if ( !match.diagnostic.codeActions.empty() ) { + rLineWidth = editor->getLineWidth( index ) + editor->getGlyphWidth(); + Color wcolor( + editor->getColorScheme().getEditorSyntaxStyle( "warning"_sst ).color ); + if ( nullptr == mLightbulbIcon ) { + mLightbulbIcon = editor->getUISceneNode()->getUIIconThemeManager()->findIcon( + "lightbulb-autofix" ); + } + if ( nullptr != mLightbulbIcon ) { + Drawable* drawable = mLightbulbIcon->getSize( (int)eefloor( lineHeight ) ); + if ( drawable == nullptr ) + return; - Color oldColor( drawable->getColor() ); - drawable->setColor( wcolor ); - drawable->draw( { position.x + rLineWidth, position.y } ); - drawable->setColor( oldColor ); - quickFixRendered = true; + Color oldColor( drawable->getColor() ); + drawable->setColor( wcolor ); + Vector2f pos = { position.x + rLineWidth, position.y }; + drawable->draw( pos ); + mQuickFixRect = { pos, drawable->getPixelsSize() }; + drawable->setColor( oldColor ); + quickFixRendered = true; + } + } else { + mQuickFixRect = {}; } } @@ -1251,7 +1262,21 @@ void LinterPlugin::goToPrevError( UICodeEditor* editor ) { } } +bool LinterPlugin::onMouseClick( UICodeEditor* editor, const Vector2i& pos, const Uint32& flags ) { + if ( ( flags & EE_BUTTON_LMASK ) && mQuickFixRect.Right != 0 && mQuickFixRect.Bottom != 0 && + mQuickFixRect.contains( pos.asFloat() ) ) { + editor->getDocument().execute( "lsp-symbol-code-action", editor ); + return true; + } + return false; +} + bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const Uint32& flags ) { + if ( mQuickFixRect.Right != 0 && mQuickFixRect.Bottom != 0 && + mQuickFixRect.contains( pos.asFloat() ) ) { + editor->getUISceneNode()->setCursor( Cursor::Hand ); + return true; + } if ( flags != 0 ) { tryHideHoveringMatch( editor ); return false; diff --git a/src/tools/ecode/plugins/linter/linterplugin.hpp b/src/tools/ecode/plugins/linter/linterplugin.hpp index 7cd091f66..9597bee71 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.hpp +++ b/src/tools/ecode/plugins/linter/linterplugin.hpp @@ -96,6 +96,8 @@ class LinterPlugin : public Plugin { bool onMouseLeave( UICodeEditor*, const Vector2i&, const Uint32& ); + bool onMouseClick( UICodeEditor*, const Vector2i&, const Uint32& flags ); + const Time& getDelayTime() const; void setDelayTime( const Time& delayTime ); @@ -121,10 +123,12 @@ class LinterPlugin : public Plugin { void unregisterNativeLinter( const std::string& cmd ); + void preDraw( UICodeEditor*, const Vector2f&, const Float&, const TextPosition& ); + protected: std::vector mLinters; std::unordered_map> mEditors; - std::set mDocs; + std::unordered_set mDocs; std::unordered_map mEditorDocs; std::unordered_map> mDirtyDoc; std::unordered_map>> mMatches; @@ -150,6 +154,7 @@ class LinterPlugin : public Plugin { String::HashType mConfigHash{ 0 }; UIIcon* mLightbulbIcon{ nullptr }; std::string mErrorMsg; + Rectf mQuickFixRect; LinterPlugin( PluginManager* pluginManager, bool sync );