Fix compile errors on Linux.

This commit is contained in:
Jeff Young 2020-05-26 00:08:27 +01:00
parent 1f93020be4
commit f7fbb600d2
1 changed files with 8 additions and 12 deletions

View File

@ -128,9 +128,8 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
m_textEditor->AutoCompCancel();
sexprs.push( partial );
wxString top = sexprs.size() ? sexprs.top() : wxEmptyString;
if( top == "constraint" || top == "disallow" )
if( sexprs.size()
&& ( sexprs.top() == "constraint" || sexprs.top() == "disallow" ) )
{
partial = wxEmptyString;
context = SEXPR_TOKEN;
@ -146,16 +145,16 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
}
}
auto autocomplete = [&]( const wxString& partial, const wxString& tokenStr )
auto autocomplete = [this]( const wxString& aPartial, const wxString& aTokenStr )
{
wxArrayString tokens = wxSplit( tokenStr, ' ' );
bool match = partial.IsEmpty();
wxArrayString tokens = wxSplit( aTokenStr, ' ' );
bool match = aPartial.IsEmpty();
for( int i = 0; i < tokens.size() && !match; ++i )
match = tokens[i].StartsWith( partial );
for( size_t ii = 0; ii < tokens.size() && !match; ++ii )
match = tokens[ii].StartsWith( aPartial );
if( match )
m_textEditor->AutoCompShow( partial.size(), tokenStr );
m_textEditor->AutoCompShow( aPartial.size(), aTokenStr );
};
// NB: tokens MUST be in alphabetical order because the Scintilla engine is going
@ -181,9 +180,6 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
else if( sexprs.top() == "disallow" )
tokens = "buried_via graphic hole micro_via pad text track via zone";
int wordStartPos = m_textEditor->WordStartPosition( currentPos, true );
wxASSERT( currentPos - wordStartPos == partial.size() );
if( !tokens.IsEmpty() )
autocomplete( partial, tokens );
}