From 01b393e84841857b4e4960ea0d49d6ad2bc4638c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 13 Aug 2024 01:32:52 -0300 Subject: [PATCH] Fix double click selection on locked documents. Fix UITextEdit multi-line rendering + Fix DocumentView::isLineVisible. Fix AutoClose brackets being applied even when was not enabled (ex. UITextInput). --- src/eepp/ui/doc/documentview.cpp | 2 +- src/eepp/ui/doc/textdocument.cpp | 2 +- src/eepp/ui/uicodeeditor.cpp | 4 ++-- src/eepp/ui/uitextedit.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/eepp/ui/doc/documentview.cpp b/src/eepp/ui/doc/documentview.cpp index 632b3bf20..1630350e5 100644 --- a/src/eepp/ui/doc/documentview.cpp +++ b/src/eepp/ui/doc/documentview.cpp @@ -401,7 +401,7 @@ double DocumentView::getLineYOffset( Int64 docIdx, Float lineHeight ) const { } bool DocumentView::isLineVisible( Int64 docIdx ) const { - return mDocLineToVisibleIndex.empty() || + return mDocLineToVisibleIndex.empty() || isOneToOne() || ( docIdx < static_cast( mDocLineToVisibleIndex.size() ) && mDocLineToVisibleIndex[docIdx] != static_cast( VisibleIndex::invalid ) ); } diff --git a/src/eepp/ui/doc/textdocument.cpp b/src/eepp/ui/doc/textdocument.cpp index c9f469586..6cb1c61e2 100644 --- a/src/eepp/ui/doc/textdocument.cpp +++ b/src/eepp/ui/doc/textdocument.cpp @@ -1645,7 +1645,7 @@ void TextDocument::textInput( const String& text, bool mightBeInteresting ) { BoolScopedOp op( mDoingTextInput, true ); BoolScopedOp op2( mInsertingText, true ); - if ( 1 == text.size() ) { + if ( 1 == text.size() && mAutoCloseBrackets ) { auto inserted = autoCloseBrackets( text ); if ( !inserted.empty() ) { diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 93b40307f..777a704f4 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -1585,7 +1585,7 @@ Uint32 UICodeEditor::onMouseDoubleClick( const Vector2i& position, const Uint32& if ( plugin->onMouseDoubleClick( this, position, flags ) ) return UIWidget::onMouseDoubleClick( position, flags ); - if ( mLocked || NULL == mFont ) + if ( NULL == mFont ) return 1; if ( mMinimapEnabled ) { @@ -1594,7 +1594,7 @@ Uint32 UICodeEditor::onMouseDoubleClick( const Vector2i& position, const Uint32& return 1; } - if ( flags & EE_BUTTON_LMASK ) { + if ( isTextSelectionEnabled() && ( flags & EE_BUTTON_LMASK ) ) { mDoc->selectWord( false ); mLastDoubleClick.restart(); checkColorPickerAction(); diff --git a/src/eepp/ui/uitextedit.cpp b/src/eepp/ui/uitextedit.cpp index abfce9e00..2d962b5ef 100644 --- a/src/eepp/ui/uitextedit.cpp +++ b/src/eepp/ui/uitextedit.cpp @@ -51,7 +51,7 @@ Uint32 UITextEdit::getType() const { } bool UITextEdit::isType( const Uint32& type ) const { - return UITextEdit::getType() == type ? true : UIWidget::isType( type ); + return UITextEdit::getType() == type ? true : UICodeEditor::isType( type ); } void UITextEdit::setTheme( UITheme* Theme ) {