From bf367b0dcba6b94885faf4b683659d5fe511e335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 23 Feb 2023 01:30:17 -0300 Subject: [PATCH] Closes SpartanJ/ecode#61. --- src/eepp/graphics/text.cpp | 3 +++ src/eepp/system/process.cpp | 2 -- src/thirdparty/subprocess/subprocess.h | 1 + src/tools/ecode/plugins/lsp/lspclientservermanager.cpp | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/eepp/graphics/text.cpp b/src/eepp/graphics/text.cpp index 1dcb1149c..7e07d1e66 100644 --- a/src/eepp/graphics/text.cpp +++ b/src/eepp/graphics/text.cpp @@ -358,6 +358,9 @@ Int32 Text::findCharacterFromPos( const Vector2i& pos, bool ) const { if ( mString[start] == '\n' && start + 1 < mString.size() ) { start++; } + + if ( end >= mGlyphCache.size() ) + end = mGlyphCache.size() - 1; for ( std::size_t i = start; i <= end; ++i ) { charCenter.x = mGlyphCache[i].Left; diff --git a/src/eepp/system/process.cpp b/src/eepp/system/process.cpp index e8bf9a64d..b301dbf30 100644 --- a/src/eepp/system/process.cpp +++ b/src/eepp/system/process.cpp @@ -35,8 +35,6 @@ Process::Process( const std::string& command, const Uint32& options, Process::~Process() { mShuttingDown = true; - if ( mProcess ) - destroy(); if ( mProcess && isAlive() ) kill(); if ( mStdOutThread.joinable() ) diff --git a/src/thirdparty/subprocess/subprocess.h b/src/thirdparty/subprocess/subprocess.h index 522ee1993..0fb8ff580 100644 --- a/src/thirdparty/subprocess/subprocess.h +++ b/src/thirdparty/subprocess/subprocess.h @@ -1153,6 +1153,7 @@ int subprocess_terminate(struct subprocess_s *const process) { TerminateProcess(process->hProcess, killed_process_exit_code); success_terminate = (windows_call_result == 0) ? 1 : 0; process->alive = 0; + process->hProcess = NULL; return success_terminate; #else int result; diff --git a/src/tools/ecode/plugins/lsp/lspclientservermanager.cpp b/src/tools/ecode/plugins/lsp/lspclientservermanager.cpp index 2c5daaae1..297425304 100644 --- a/src/tools/ecode/plugins/lsp/lspclientservermanager.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientservermanager.cpp @@ -55,7 +55,8 @@ std::string LSPClientServerManager::findRootPath( const LSPDefinition& lsp, const std::shared_ptr& doc ) { if ( lsp.rootIndicationFileNames.empty() || !doc->hasFilepath() ) return ""; - std::string rootPath( doc->getFileInfo().getDirectoryPath() ); + std::string oriRootPath( doc->getFileInfo().getDirectoryPath() ); + std::string rootPath( oriRootPath ); std::string lRootPath; FileSystem::dirAddSlashAtEnd( rootPath ); @@ -73,7 +74,7 @@ std::string LSPClientServerManager::findRootPath( const LSPDefinition& lsp, rootPath = FileSystem::removeLastFolderFromPath( rootPath ); } - return ""; + return oriRootPath; } void LSPClientServerManager::tryRunServer( const std::shared_ptr& doc ) {