A couple of minor fixes.

This commit is contained in:
Martín Lucas Golini
2023-03-05 18:42:14 -03:00
parent 7d7a97e60d
commit 05117d8024
2 changed files with 16 additions and 13 deletions

View File

@@ -138,17 +138,15 @@ void UIDropDownList::showList() {
Float sliderValue = mListBox->getVerticalScrollBar()->getValue();
if ( mStyleConfig.MaxNumVisibleItems < mListBox->getCount() ) {
mListBox->setSize(
NULL != mFriendNode ? mFriendNode->getSize().getWidth() : getSize().getWidth(),
(Int32)( mStyleConfig.MaxNumVisibleItems * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
} else {
mListBox->setSize( NULL != mFriendNode ? mFriendNode->getSize().getWidth()
: getSize().getWidth(),
(Int32)( mListBox->getCount() * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
}
mListBox->setSize(
NULL != mFriendNode ? mFriendNode->getSize().getWidth() : getSize().getWidth(),
(Int32)( std::min( mListBox->getCount(), mStyleConfig.MaxNumVisibleItems ) *
mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom +
( mListBox->getHorizontalScrollBar() &&
mListBox->getHorizontalScrollBar()->isVisible()
? mListBox->getHorizontalScrollBar()->getSize().getHeight()
: 0.f ) );
mListBox->getVerticalScrollBar()->setValue( sliderValue );
@@ -208,8 +206,9 @@ void UIDropDownList::setMaxNumVisibleItems( const Uint32& maxNumVisibleItems ) {
mStyleConfig.MaxNumVisibleItems = maxNumVisibleItems;
if ( NULL != mListBox )
mListBox->setSize( getSize().getWidth(),
mStyleConfig.MaxNumVisibleItems * mListBox->getRowHeight() );
mListBox->setSize( getSize().getWidth(), std::min( mStyleConfig.MaxNumVisibleItems,
getListBox()->getCount() ) *
mListBox->getRowHeight() );
}
}

View File

@@ -127,6 +127,10 @@ void TerminalManager::configureTerminalShell() {
: Sys::which( shellEnv ) );
if ( !shellEnvStr.empty() )
shellCombo->getListBox()->setSelected( shellEnvStr );
} else if ( Sys::getPlatform() == "Windows" ) {
std::string shellEnvStr( Sys::which( "powershell" ) );
if ( !shellEnvStr.empty() )
shellCombo->getListBox()->setSelected( shellEnvStr );
}
auto setShellFn = []( App* app, UIWindow* window, UIComboBox* shellCombo ) {
std::string shell( shellCombo->getText().toUtf8() );