Skip to content

Fixed "%s" always being left justify #2332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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