7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 20:31:41 +00:00

Autocomplete for ERC/DRCERROR/WARNING.

Also improves autocomplete to select the last substitution
token (if any) in the autocompleted text.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19133
This commit is contained in:
Jeff Young 2024-11-17 16:26:33 +00:00
parent 120106c6c6
commit 712caeb00e
3 changed files with 21 additions and 1 deletions

View File

@ -217,7 +217,22 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
}
else if( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
{
int start = m_te->AutoCompPosStart();
m_te->AutoCompComplete();
int finish = m_te->GetCurrentPos();
if( finish > start )
{
// Select the last substitution token (if any) in the autocompleted text
int selStart = m_te->FindText( finish, start, "<" );
int selEnd = m_te->FindText( finish, start, ">" );
if( selStart > start && selEnd <= finish && selEnd > selStart )
m_te->SetSelection( selStart, selEnd + 1 );
}
}
else
{
@ -610,7 +625,8 @@ void SCINTILLA_TRICKS::DoAutocomplete( const wxString& aPartial, const wxArraySt
return first.CmpNoCase( second );
});
m_te->AutoCompShow( aPartial.size(), wxJoin( matchedTokens, m_te->AutoCompGetSeparator() ) );
m_te->AutoCompSetSeparator( '\t' );
m_te->AutoCompShow( aPartial.size(), wxJoin( matchedTokens, '\t' ) );
}
}

View File

@ -244,6 +244,8 @@ void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
add( wxT( "EXCLUDE_FROM_BOARD" ) );
add( wxT( "EXCLUDE_FROM_SIM" ) );
add( wxT( "DNP" ) );
add( wxT( "ERC_ERROR <message_text>" ) );
add( wxT( "ERC_WARNING <message_text>" ) );
m_screen->GetTitleBlock().GetContextualTextVars( aVars );
}

View File

@ -417,6 +417,8 @@ void BOARD::GetContextualTextVars( wxArrayString* aVars ) const
add( wxT( "FILENAME" ) );
add( wxT( "FILEPATH" ) );
add( wxT( "PROJECTNAME" ) );
add( wxT( "DRC_ERROR <message_text>" ) );
add( wxT( "DRC_WARNING <message_text>" ) );
GetTitleBlock().GetContextualTextVars( aVars );