From 9e764c8100c3b6d6f9e7354efcd699dea8466b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sat, 13 Jan 2024 18:04:23 -0300 Subject: [PATCH] Fix crash on UITabWidget. Improve LSP tooltip. Remove warnings. --- bin/assets/ui/breeze.css | 2 +- projects/linux/ee.files | 1 + src/eepp/ui/uitabwidget.cpp | 30 ++++++++++--------- src/tools/ecode/plugins/git/git.hpp | 1 + src/tools/ecode/plugins/git/gitplugin.hpp | 4 +-- .../ecode/plugins/lsp/lspclientplugin.cpp | 7 ++++- src/tools/ecode/version.hpp | 2 +- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index 1a0c2bc36..f1ef5d817 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -37,7 +37,7 @@ --menu-font-active: white; --menu-font-disabled: #6e7275; --win-icon: #dbdbdd; - --floating-icon: #eff0f188; + --floating-icon: #96999c; --term-back-color: #1e2127; --term-font-color: #abb2bf; --highlight-primary: #FFFFFF7A; diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 61e37b69b..7fa0271ea 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -1350,6 +1350,7 @@ ../../src/thirdparty/efsw/src/test/efsw-test.cpp ../../src/tools/ecode/appconfig.cpp ../../src/tools/ecode/appconfig.hpp +../../src/tools/ecode/applayout.xml.hpp ../../src/tools/ecode/commandpalette.cpp ../../src/tools/ecode/commandpalette.hpp ../../src/tools/ecode/ecode.cpp diff --git a/src/eepp/ui/uitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp index bec016ec7..b779997b9 100644 --- a/src/eepp/ui/uitabwidget.cpp +++ b/src/eepp/ui/uitabwidget.cpp @@ -1069,23 +1069,25 @@ void UITabWidget::updateScroll( bool updateFocus ) { mTabScroll->setPixelsPosition( { -mTabBar->getPixelsPosition().x, mTabScroll->getPixelsPosition().y } ); - Rectf r = mTabScroll->getRectBox(); - Rectf r2 = mTabSelected->getRectBox(); + if ( updateFocus && mTabSelected ) { + Rectf r = mTabScroll->getRectBox(); + Rectf r2 = mTabSelected->getRectBox(); - if ( updateFocus && mTabSelected && !( r.Left <= r2.Left && r.Right >= r2.Right ) ) { - size_t pIndex = mFocusHistory.size() >= 2 - ? getTabIndex( mFocusHistory.at( mFocusHistory.size() - 2 ) ) - : getTabIndex( mFocusHistory.back() ); + if ( !( r.Left <= r2.Left && r.Right >= r2.Right ) ) { + size_t pIndex = mFocusHistory.size() >= 2 + ? getTabIndex( mFocusHistory.at( mFocusHistory.size() - 2 ) ) + : getTabIndex( mFocusHistory.back() ); - Float x = mTabSelectedIndex > pIndex - ? eeclamp( mTabSelected->getPixelsPosition().x + - mTabSelected->getPixelsSize().getWidth() - - mTabScroll->getPixelsSize().getWidth(), - 0.f, mTabScroll->getMaxValue() ) - : eeclamp( mTabSelected->getPixelsPosition().x, 0.f, - mTabScroll->getMaxValue() ); + Float x = mTabSelectedIndex > pIndex + ? eeclamp( mTabSelected->getPixelsPosition().x + + mTabSelected->getPixelsSize().getWidth() - + mTabScroll->getPixelsSize().getWidth(), + 0.f, mTabScroll->getMaxValue() ) + : eeclamp( mTabSelected->getPixelsPosition().x, 0.f, + mTabScroll->getMaxValue() ); - mTabScroll->setValue( x ); + mTabScroll->setValue( x ); + } } } } diff --git a/src/tools/ecode/plugins/git/git.hpp b/src/tools/ecode/plugins/git/git.hpp index 25e5c2d07..8dc178a90 100644 --- a/src/tools/ecode/plugins/git/git.hpp +++ b/src/tools/ecode/plugins/git/git.hpp @@ -91,6 +91,7 @@ class Git { case All: return ALL; } + return nullptr; } struct Branch { /** Branch name */ diff --git a/src/tools/ecode/plugins/git/gitplugin.hpp b/src/tools/ecode/plugins/git/gitplugin.hpp index 587c2dee4..ee46f789c 100644 --- a/src/tools/ecode/plugins/git/gitplugin.hpp +++ b/src/tools/ecode/plugins/git/gitplugin.hpp @@ -112,7 +112,7 @@ class GitBranchModel : public Model { size_t columnCount( const ModelIndex& ) const { return 4; } Variant data( const ModelIndex& index, ModelRole role ) const { - if ( role == ModelRole::Display && index.row() < mBranches.size() ) { + if ( role == ModelRole::Display && index.row() < (Int64)mBranches.size() ) { const Git::Branch& branch = mBranches[index.row()]; switch ( index.column() ) { case Column::Name: @@ -147,7 +147,7 @@ class GitStatusModel : public Model { size_t columnCount( const ModelIndex& ) const { return 4; } Variant data( const ModelIndex& index, ModelRole role ) const { - if ( role == ModelRole::Display && index.row() < mStatus.size() ) { + if ( role == ModelRole::Display && index.row() < (Int64)mStatus.size() ) { const Git::DiffFile& s = mStatus[index.row()]; switch ( index.column() ) { case Column::File: diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp index 220ecd198..094f3c81b 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp @@ -1513,6 +1513,11 @@ bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& positio if ( editorExists( editor ) && !resp.contents.empty() && !resp.contents[0].value.empty() ) { editor->runOnMainThread( [editor, resp, position, this]() { + if ( !editor->getScreenRect().contains( editor->getUISceneNode() + ->getWindow() + ->getInput() + ->getMousePosf() ) ) + return; tryDisplayTooltip( editor, resp, position ); } ); } @@ -1544,7 +1549,7 @@ void LSPClientPlugin::setHoverDelay( const Time& hoverDelay ) { mHoverDelay = hoverDelay; } -void LSPClientPlugin::onVersionUpgrade( Uint32 oldVersion, Uint32 currentVersion ) { +void LSPClientPlugin::onVersionUpgrade( Uint32 oldVersion, Uint32 ) { if ( oldVersion <= ECODE_VERSIONNUM( 0, 5, 0 ) ) { mSemanticHighlighting = true; } diff --git a/src/tools/ecode/version.hpp b/src/tools/ecode/version.hpp index 7c28b3635..3e5d581dd 100644 --- a/src/tools/ecode/version.hpp +++ b/src/tools/ecode/version.hpp @@ -8,7 +8,7 @@ using namespace EE; #define ECODE_MAJOR_VERSION 0 #define ECODE_MINOR_VERSION 5 -#define ECODE_PATCH_LEVEL 0 +#define ECODE_PATCH_LEVEL 1 #define ECODE_CODENAME "Ākāśa" /** The compiled version of the library */