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,10 +323,12 @@ void SelectReferenceNumber( wxTextEntry* aTextEntry )
|
||||||
|
|
||||||
while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
|
while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
|
||||||
{
|
{
|
||||||
|
// Trim non-digit from end
|
||||||
if( !isdigit( num.Last() ) )
|
if( !isdigit( num.Last() ) )
|
||||||
num.RemoveLast();
|
num.RemoveLast();
|
||||||
|
|
||||||
if( !isdigit( num.GetChar ( 0 ) ) )
|
// Trim non-digit from the start
|
||||||
|
if( !num.IsEmpty() && !isdigit( num.GetChar( 0 ) ) )
|
||||||
num = num.Right( num.Length() - 1 );
|
num = num.Right( num.Length() - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue