Change DELETE behaviour from delete sel to delete forward.

In other words, if there's no selection delete the character in
front of the cursor.

Fixes https://gitlab.com/kicad/code/kicad/issues/4609
This commit is contained in:
Jeff Young 2020-06-05 13:35:35 +01:00
parent 4357c1d3b3
commit 22b8133108
2 changed files with 11 additions and 2 deletions

View File

@ -129,6 +129,11 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
{
if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
m_te->DeleteBack();
else
{
m_te->CharRight();
m_te->DeleteBack();
}
}
else
{

View File

@ -59,12 +59,12 @@ void TEXTENTRY_TRICKS::OnCharHook( wxTextEntry* aTextEntry, wxKeyEvent& aEvent )
long start, end;
aTextEntry->GetSelection( &start, &end );
if( start > end )
if( end > start )
{
aTextEntry->Remove( start, end );
aTextEntry->SetInsertionPoint( start );
}
else if (start == end && start > 0 )
else if ( start == end && start > 0 )
{
aTextEntry->Remove( start-1, start );
aTextEntry->SetInsertionPoint( start-1 );
@ -80,6 +80,10 @@ void TEXTENTRY_TRICKS::OnCharHook( wxTextEntry* aTextEntry, wxKeyEvent& aEvent )
aTextEntry->Remove( start, end );
aTextEntry->SetInsertionPoint( start );
}
else if( start == end && start < aTextEntry->GetLastPosition() )
{
aTextEntry->Remove( start, start+1 );
}
}
else
{