| 341 | } |
| 342 | |
| 343 | void UniversalLocator::updateFilesTable( bool useGlob ) { |
| 344 | auto text = mLocateInput->getText(); |
| 345 | |
| 346 | if ( pathHasPosition( text ) ) { |
| 347 | auto pathAndPos = getPathAndPosition( text ); |
| 348 | text = pathAndPos.first; |
| 349 | } |
| 350 | |
| 351 | if ( useGlob && String::startsWith( text, "g " ) ) |
| 352 | text = text.substr( 2 ); |
| 353 | |
| 354 | if ( !mApp->isDirTreeReady() ) { |
| 355 | mLocateTable->setModel( |
| 356 | ProjectDirectoryTree::emptyModel( getLocatorCommands(), mApp->getCurrentProject() ) ); |
| 357 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 358 | } else if ( !mLocateInput->getText().empty() ) { |
| 359 | mApp->getDirTree()->asyncMatchTree( |
| 360 | useGlob ? ProjectDirectoryTree::MatchType::Glob |
| 361 | : ProjectDirectoryTree::MatchType::Fuzzy, |
| 362 | text, LOCATEBAR_MAX_RESULTS, |
| 363 | [this, text]( auto res ) { |
| 364 | mUISceneNode->runOnMainThread( [this, res] { |
| 365 | mLocateTable->setModel( res ); |
| 366 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 367 | mLocateTable->scrollToTop(); |
| 368 | updateLocateBarSync(); |
| 369 | } ); |
| 370 | }, |
| 371 | mApp->getCurrentProject() ); |
| 372 | } else { |
| 373 | mLocateTable->setModel( mApp->getDirTree()->asModel( |
| 374 | LOCATEBAR_MAX_RESULTS, getLocatorCommands(), mApp->getCurrentProject(), |
| 375 | Image::getImageExtensionsSupported() ) ); |
| 376 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | void UniversalLocator::updateCommandPaletteTable() { |
| 381 | if ( !mCommandPalette.isSet() ) |
no test coverage detected