Fix excess spacing when beautifying class names with underscores.

This commit is contained in:
Mari the Deer 2024-01-31 20:50:51 +01:00
commit 82f94872cb
2 changed files with 5 additions and 2 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1100 \cu(Wed 31 Jan 10:13:38 CET 2024)\c-";
SWWM_SHORTVER="\cw1.3pre r1100 \cu(2024-01-31 10:13:38)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1101 \cu(Wed 31 Jan 20:50:51 CET 2024)\c-";
SWWM_SHORTVER="\cw1.3pre r1101 \cu(2024-01-31 20:50:51)\c-";

View file

@ -125,9 +125,11 @@ extend Class SWWMUtility
int cp1;
[cp1, pos] = workstr.GetNextCodePoint(pos);
str.AppendCharacter(cp1);
if ( cp1 == 0x20 ) continue; // already spaced
if ( i < len-1 )
{
let [cp2, pos2] = workstr.GetNextCodePoint(pos);
if ( cp2 == 0x20 ) continue; // already spaced
// this looks awkward, but I have to also account for non-letter characters
// uppercase after lowercase
if ( (String.CharUpper(cp1) != cp1) && (String.CharLower(cp2) != cp2) )
@ -144,6 +146,7 @@ extend Class SWWMUtility
if ( i < len-2 )
{
let [cp3, pos3] = workstr.GetNextCodePoint(pos2);
if ( cp3 == 0x20 ) continue; // already spaced
// uppercase before uppercase before lowercase
if ( (String.CharLower(cp1) != cp1) && (String.CharLower(cp2) != cp2) && (String.CharUpper(cp3) != cp3) )
str.AppendCharacter(0x20);