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() ) if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
m_te->DeleteBack(); m_te->DeleteBack();
else
{
m_te->CharRight();
m_te->DeleteBack();
}
} }
else else
{ {

View File

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