mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-02 11:10:31 +03:00
IME fixes that should fix SpartanJ/ecode#355.
Fix a crash when loading empty file from disk.
This commit is contained in:
@@ -230,6 +230,8 @@ void EventDispatcher::sendTextInput( const Uint32& textChar, const Uint32& times
|
|||||||
void EventDispatcher::sendTextEditing( const String& text, const Int32& start,
|
void EventDispatcher::sendTextEditing( const String& text, const Int32& start,
|
||||||
const Int32& length ) {
|
const Int32& length ) {
|
||||||
mWindow->getIME().onTextEditing( text, start, length );
|
mWindow->getIME().onTextEditing( text, start, length );
|
||||||
|
if ( !mWindow->getIME().isEditing() && length <= 0 )
|
||||||
|
return;
|
||||||
TextEditingEvent textEditingEvent =
|
TextEditingEvent textEditingEvent =
|
||||||
TextEditingEvent( mFocusNode, Event::TextInput, text, start, length );
|
TextEditingEvent( mFocusNode, Event::TextInput, text, start, length );
|
||||||
Node* node = mFocusNode;
|
Node* node = mFocusNode;
|
||||||
|
|||||||
@@ -1170,7 +1170,7 @@ Sizef UICodeEditor::getViewportDimensions() const {
|
|||||||
Rectf UICodeEditor::getScreenPosition( const TextPosition& position ) const {
|
Rectf UICodeEditor::getScreenPosition( const TextPosition& position ) const {
|
||||||
Float lineHeight = getLineHeight();
|
Float lineHeight = getLineHeight();
|
||||||
Vector2f screenStart( getScreenStart() );
|
Vector2f screenStart( getScreenStart() );
|
||||||
Vector2f start( screenStart.x + getGutterWidth(), screenStart.y );
|
Vector2f start( screenStart.x + getGutterWidth(), screenStart.y + getPluginsTopSpace() );
|
||||||
Vector2f startScroll( start - mScroll );
|
Vector2f startScroll( start - mScroll );
|
||||||
auto offset = getTextPositionOffsetSanitized( position, lineHeight );
|
auto offset = getTextPositionOffsetSanitized( position, lineHeight );
|
||||||
return { { static_cast<Float>( startScroll.x + offset.x ),
|
return { { static_cast<Float>( startScroll.x + offset.x ),
|
||||||
@@ -4332,9 +4332,10 @@ Float UICodeEditor::getMinimapWidth() const {
|
|||||||
if ( !mMinimapEnabled )
|
if ( !mMinimapEnabled )
|
||||||
return 0.f;
|
return 0.f;
|
||||||
Float w = PixelDensity::dpToPx( mMinimapConfig.width );
|
Float w = PixelDensity::dpToPx( mMinimapConfig.width );
|
||||||
|
Float pw = getPixelsSize().getWidth();
|
||||||
// Max [mMinimapConfig.maxPercentWidth]% of the editor view width
|
// Max [mMinimapConfig.maxPercentWidth]% of the editor view width
|
||||||
if ( w / getPixelsSize().getWidth() > mMinimapConfig.maxPercentWidth )
|
if ( pw != 0 && w / pw > mMinimapConfig.maxPercentWidth )
|
||||||
w = getPixelsSize().getWidth() * mMinimapConfig.maxPercentWidth;
|
w = pw * mMinimapConfig.maxPercentWidth;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -755,7 +755,10 @@ void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* ed
|
|||||||
|
|
||||||
editorSplitter->loadAsyncFileFromPathInNewTab(
|
editorSplitter->loadAsyncFileFromPathInNewTab(
|
||||||
snapshotFile.cachePath,
|
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();
|
TextDocument& doc = editor->getDocument();
|
||||||
auto selection = TextRange::fromString( snapshotFile.selection );
|
auto selection = TextRange::fromString( snapshotFile.selection );
|
||||||
doc.setDefaultFileName( snapshotFile.name );
|
doc.setDefaultFileName( snapshotFile.name );
|
||||||
|
|||||||
Reference in New Issue
Block a user