Make select-all hack work with Scintilla too.

Fixes https://gitlab.com/kicad/code/kicad/issues/8876
This commit is contained in:
Jeff Young 2021-07-28 00:15:55 +01:00
parent 29b23df7a1
commit 3a5d49f7b2
1 changed files with 22 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <wx/grid.h>
#include <wx/bmpbuttn.h>
#include <wx/textctrl.h>
#include <wx/stc/stc.h>
#include <algorithm>
@ -323,12 +324,31 @@ static void selectAllInTextCtrls( wxWindowList& children )
{
if( wxTextCtrl* childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) )
{
// We don't currently run this on GTK because some window managers don't hide the
// selection in non-active controls, and other window managers do the selection
// automatically anyway.
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
if( !childTextCtrl->GetStringSelection().IsEmpty() )
{
// Respect an existing selection
if( childTextCtrl->GetStringSelection().IsEmpty() )
}
else
{
childTextCtrl->SelectAll();
}
#endif
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
{
if( !scintilla->GetSelectedText().IsEmpty() )
{
// Respect an existing selection
}
else
{
scintilla->SelectAll();
}
}
#ifdef __WXMAC__
// Temp hack for square (looking) buttons on OSX. Will likely be made redundant
// by the image store....