Optimize multiple cursors selection (issue SpartanJ/ecode#356).

This commit is contained in:
Martín Lucas Golini
2024-11-08 02:40:46 -03:00
parent 6d91ac11d8
commit 0027e0b22b
3 changed files with 29 additions and 20 deletions

View File

@@ -1411,8 +1411,13 @@ Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags
TextRange range( mDoc->getSelection().start(), textScreenPos );
range.normalize();
range = mDoc->sanitizeRange( range );
for ( Int64 i = range.start().line(); i < range.end().line(); ++i )
mDoc->addSelection( { i, range.start().column() } );
TextRanges ranges;
ranges.reserve( range.end().line() - range.start().line() + 1 );
for ( Int64 i = range.start().line(); i < range.end().line(); ++i ) {
TextPosition pos{ i, range.start().column() };
ranges.push_back( TextRange{ pos, pos } );
}
mDoc->addSelections( std::move( ranges ) );
} else if ( input->isModState( KEYMOD_SHIFT ) ) {
mDoc->selectTo( textScreenPos );
} else if ( input->isModState( KEYMOD_CTRL ) &&

View File

@@ -8,7 +8,7 @@ using namespace EE;
#define ECODE_MAJOR_VERSION 0
#define ECODE_MINOR_VERSION 6
#define ECODE_PATCH_LEVEL 3
#define ECODE_PATCH_LEVEL 4
/* ECODE_COMMIT_NUMBER 9999 is used for official releases, nightly builds (pre-releases) will
* contain the number of commits after the last official release
*/