| 378 | } |
| 379 | |
| 380 | void UniversalLocator::updateCommandPaletteTable() { |
| 381 | if ( !mCommandPalette.isSet() ) |
| 382 | mCommandPalette.setCommandPalette( mApp->getMainLayout()->getCommandList(), |
| 383 | mApp->getMainLayout()->getKeyBindings() ); |
| 384 | |
| 385 | if ( !mCommandPalette.isEditorSet() && mSplitter->curEditorIsNotNull() ) |
| 386 | mCommandPalette.setEditorCommandPalette( |
| 387 | mSplitter->getCurEditor()->getDocumentRef()->getCommandList(), |
| 388 | mSplitter->getCurEditor()->getKeyBindings() ); |
| 389 | |
| 390 | mCommandPalette.setCurModel( mSplitter->curEditorIsNotNull() ? mCommandPalette.getEditorModel() |
| 391 | : mCommandPalette.getBaseModel() ); |
| 392 | |
| 393 | auto txt( mLocateInput->getText() ); |
| 394 | txt.trim(); |
| 395 | |
| 396 | if ( txt.size() > 1 ) { |
| 397 | mCommandPalette.asyncFuzzyMatch( txt.substr( 1 ).trim(), 10000, [this]( auto res ) { |
| 398 | mUISceneNode->runOnMainThread( [this, res] { |
| 399 | mLocateTable->setModel( res ); |
| 400 | if ( mLocateTable->getModel()->hasChildren() ) |
| 401 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 402 | mLocateTable->scrollToTop(); |
| 403 | } ); |
| 404 | } ); |
| 405 | } else if ( mCommandPalette.getCurModel() ) { |
| 406 | mLocateTable->setModel( mCommandPalette.getCurModel() ); |
| 407 | if ( mLocateTable->getModel()->hasChildren() ) |
| 408 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | void UniversalLocator::showLocateTable() { |
| 413 | mLocateTable->setVisible( true ); |
nothing calls this directly
no test coverage detected