diff --git a/src/eepp/scene/eventdispatcher.cpp b/src/eepp/scene/eventdispatcher.cpp index 0166f7fb8..ca686f479 100644 --- a/src/eepp/scene/eventdispatcher.cpp +++ b/src/eepp/scene/eventdispatcher.cpp @@ -230,6 +230,8 @@ void EventDispatcher::sendTextInput( const Uint32& textChar, const Uint32& times void EventDispatcher::sendTextEditing( const String& text, const Int32& start, const Int32& length ) { mWindow->getIME().onTextEditing( text, start, length ); + if ( !mWindow->getIME().isEditing() && length <= 0 ) + return; TextEditingEvent textEditingEvent = TextEditingEvent( mFocusNode, Event::TextInput, text, start, length ); Node* node = mFocusNode; diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index abac9502e..7cc87254c 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -1170,7 +1170,7 @@ Sizef UICodeEditor::getViewportDimensions() const { Rectf UICodeEditor::getScreenPosition( const TextPosition& position ) const { Float lineHeight = getLineHeight(); Vector2f screenStart( getScreenStart() ); - Vector2f start( screenStart.x + getGutterWidth(), screenStart.y ); + Vector2f start( screenStart.x + getGutterWidth(), screenStart.y + getPluginsTopSpace() ); Vector2f startScroll( start - mScroll ); auto offset = getTextPositionOffsetSanitized( position, lineHeight ); return { { static_cast( startScroll.x + offset.x ), @@ -4332,9 +4332,10 @@ Float UICodeEditor::getMinimapWidth() const { if ( !mMinimapEnabled ) return 0.f; Float w = PixelDensity::dpToPx( mMinimapConfig.width ); + Float pw = getPixelsSize().getWidth(); // Max [mMinimapConfig.maxPercentWidth]% of the editor view width - if ( w / getPixelsSize().getWidth() > mMinimapConfig.maxPercentWidth ) - w = getPixelsSize().getWidth() * mMinimapConfig.maxPercentWidth; + if ( pw != 0 && w / pw > mMinimapConfig.maxPercentWidth ) + w = pw * mMinimapConfig.maxPercentWidth; return w; } diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp index 0a89a4fd4..e99560c68 100644 --- a/src/tools/ecode/appconfig.cpp +++ b/src/tools/ecode/appconfig.cpp @@ -755,7 +755,10 @@ void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* ed editorSplitter->loadAsyncFileFromPathInNewTab( snapshotFile.cachePath, - [snapshotFile]( UICodeEditor* editor, const std::string& ) { + [snapshotFile, editorSplitter]( UICodeEditor* editor, const std::string& ) { + // Editor could have been closed right after load + if ( !editorSplitter->editorExists( editor ) ) + return; TextDocument& doc = editor->getDocument(); auto selection = TextRange::fromString( snapshotFile.selection ); doc.setDefaultFileName( snapshotFile.name );