Eeschema: Fix/circumvert GTK3 tree view bug
There is a rendering bug in GTK3, which appears to be an upstream GTK issue. This can be worked around by, when filtering, ensuring the *parent* item of the selected item is visible. This will not cause the selected item to not be visible, as the selected item will be the first shown child. So it will be visible, as long as the list box is greater than a single row high, which it will be in all practical scenarios. This is done on all platforms, as it has a beneficial side-effect: the parent library of the selection is naturally shown to the user, so they don't need to scroll up to see what library their current filter selection was in. Fixes: lp:1804400 * https://bugs.launchpad.net/kicad/+bug/1804400
This commit is contained in:
parent
e808c7f956
commit
10900c918f
|
@ -182,6 +182,22 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
||||||
{
|
{
|
||||||
auto item = wxDataViewItem( bestMatch );
|
auto item = wxDataViewItem( bestMatch );
|
||||||
m_widget->Select( item );
|
m_widget->Select( item );
|
||||||
|
|
||||||
|
// Make sure the *parent* item is visible. The selected item is the
|
||||||
|
// first (shown) child of the parent. So it's always right below the parent,
|
||||||
|
// and this way the user can also see what library the selected part belongs to,
|
||||||
|
// without having a case where the selection is off the screen (unless the
|
||||||
|
// window is a single row high, which is unlikely)
|
||||||
|
//
|
||||||
|
// This also happens to circumvent https://bugs.launchpad.net/kicad/+bug/1804400
|
||||||
|
// which appears to be a GTK+3 bug.
|
||||||
|
{
|
||||||
|
wxDataViewItem parent = GetParent( item );
|
||||||
|
|
||||||
|
if( parent.IsOk() )
|
||||||
|
item = parent;
|
||||||
|
}
|
||||||
|
|
||||||
m_widget->EnsureVisible( item );
|
m_widget->EnsureVisible( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue