Don't trim both back and front if there's only one char.
Fixes https://gitlab.com/kicad/code/kicad/issues/5357
This commit is contained in:
parent
a55eaec28c
commit
40d7940d52
|
@ -323,11 +323,13 @@ void SelectReferenceNumber( wxTextEntry* aTextEntry )
|
|||
|
||||
while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
|
||||
{
|
||||
// Trim non-digit from end
|
||||
if( !isdigit( num.Last() ) )
|
||||
num.RemoveLast();
|
||||
|
||||
if( !isdigit( num.GetChar ( 0 ) ) )
|
||||
num = num.Right( num.Length() - 1);
|
||||
// Trim non-digit from the start
|
||||
if( !num.IsEmpty() && !isdigit( num.GetChar( 0 ) ) )
|
||||
num = num.Right( num.Length() - 1 );
|
||||
}
|
||||
|
||||
aTextEntry->SetSelection( ref.Find( num ), ref.Find( num ) + num.Length() );
|
||||
|
|
Loading…
Reference in New Issue