[Flight] Remove superfluous whitespace when console method is called with non-strings (#33953)

This commit is contained in:
Sebastian "Sebbie" Silbermann 2025-07-23 10:07:37 +02:00 committed by GitHub
parent 7513996f20
commit f6fb1a07a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 12 deletions

View File

@ -49,7 +49,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
badgeStyle,
pad + badgeName + pad,
resetStyle,

View File

@ -39,7 +39,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
pad + badgeName + pad,
);
} else {

View File

@ -50,7 +50,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
badgeStyle,
pad + badgeName + pad,
resetStyle,

View File

@ -54,7 +54,12 @@ export function unbadgeConsole(
typeof badge === 'string'
) {
// Remove our badging from the arguments.
args.splice(offset, 4, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;

View File

@ -45,7 +45,12 @@ export function unbadgeConsole(
badge.endsWith(pad)
) {
// Remove our badging from the arguments.
args.splice(offset, 2, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;

View File

@ -53,7 +53,12 @@ export function unbadgeConsole(
typeof badge === 'string'
) {
// Remove our badging from the arguments.
args.splice(offset, 4, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;