diff --git a/src/tools/ecode/universallocator.cpp b/src/tools/ecode/universallocator.cpp index 1fbcb0f8b..e65a8712f 100644 --- a/src/tools/ecode/universallocator.cpp +++ b/src/tools/ecode/universallocator.cpp @@ -225,20 +225,30 @@ void UniversalLocator::initLocateBar( UILocateBar* locateBar, UITextInput* locat mLocateTable->setHeadersVisible( false ); mLocateTable->setVisible( false ); mLocateInput->addEventListener( Event::OnTextChanged, [&]( const Event* ) { - const String& txt = mLocateInput->getText(); - if ( mSplitter->curEditorExistsAndFocused() && String::startsWith( txt, String( "l " ) ) ) { - String number( txt.substr( 2 ) ); - Int64 val; - if ( String::fromString( val, number ) && val - 1 >= 0 ) { - if ( mSplitter->curEditorExistsAndFocused() ) - mSplitter->getCurEditor()->goToLine( { val - 1, 0 } ); + const String& inputTxt = mLocateInput->getText(); + if ( mSplitter->curEditorExistsAndFocused() && + String::startsWith( inputTxt, String( "l " ) ) ) { + String lineColInput( inputTxt.substr( 2 ) ); + std::vector parts = lineColInput.split( ':' ); + Int64 line, column = 0; + + if ( parts.size() > 0 && String::fromString( line, parts[0] ) && line - 1 >= 0 ) { + if ( parts.size() > 1 ) { + String::fromString( column, parts[1] ); + if ( column < 0 ) { + column = 0; + } + } + if ( mSplitter->curEditorExistsAndFocused() ) { + mSplitter->getCurEditor()->goToLine( { line - 1, column } ); + } mLocateTable->setVisible( false ); } - } else if ( !txt.empty() && mLocateInput->getText()[0] == '>' ) { + } else if ( !inputTxt.empty() && mLocateInput->getText()[0] == '>' ) { showCommandPalette(); - } else if ( !txt.empty() && mLocateInput->getText()[0] == ':' ) { + } else if ( !inputTxt.empty() && mLocateInput->getText()[0] == ':' ) { showWorkspaceSymbol(); - } else if ( String::startsWith( txt, ". " ) ) { + } else if ( String::startsWith( inputTxt, ". " ) ) { showDocumentSymbol(); } else { showLocateTable();