Skip to content

Conversation

F1F88
Copy link
Contributor

@F1F88 F1F88 commented Jun 3, 2025

Related to: #2331

This only fixes "%s" to always be left-aligned, not include the fix for padding '0'.

If need, I can add a commit to fix the padding '0'.

Test cases

#include <sourcemod>

public void OnPluginStart()
{
    char[] text = "abcde1234567890";

    PrintToServer("|%s|", NULL_STRING);
    PrintToServer("|%s|", text);

    PrintToServer("|%.10s|", text);
    PrintToServer("|%0.10s|", text);
    PrintToServer("|%-.10s|", text);
    PrintToServer("|%-0.10s|", text);

    PrintToServer("|%20s|", text);
    PrintToServer("|%020s|", text);
    PrintToServer("|%-20s|", text);
    PrintToServer("|%-020s|", text);
}
Click to expand the output before fix
sm plugins reload test
||
|abcde1234567890|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde1234567890     |
|abcde1234567890     |
|abcde1234567890     |
|abcde1234567890     |
[SM] Plugin test.smx reloaded successfully.
Click to expand the output after fix
sm plugins reload test
||
|abcde1234567890|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde12345|
|     abcde1234567890|
|     abcde1234567890|
|abcde1234567890     |
|abcde1234567890     |
[SM] Plugin test.smx reloaded successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant