Skip to content

Fix: trim whitespace in tileset name when renaming#4495

Open
Praagya26 wants to merge 1 commit intomapeditor:masterfrom
Praagya26:fix-whitespace-tileset
Open

Fix: trim whitespace in tileset name when renaming#4495
Praagya26 wants to merge 1 commit intomapeditor:masterfrom
Praagya26:fix-whitespace-tileset

Conversation

@Praagya26
Copy link
Copy Markdown

@Praagya26 Praagya26 commented Apr 5, 2026

Problem:

  1. Renaming a tileset allowed whitespace-only names.
  2. Leading and trailing spaces were not trimmed, resulting in inconsistent naming.

Fix:

Applied QString::trimmed() to sanitize input:
In tilesetchanges.cpp using newName.trimmed()
In tilesetdocument.cpp using name.trimmed()

This ensures:
Whitespace-only names are rejected.
Leading and trailing spaces are removed before further processing.

Result:

Prevents invalid or empty tileset names.
Improves consistency and reliability of naming behavior.

Future Work:

As suggested by @kunal649, consider introducing a CENTRALIZED VALIDATION UTILITY.
This would help enforce consistent naming rules across the codebase and reduce duplication.

@kunal649
Copy link
Copy Markdown
Contributor

kunal649 commented Apr 5, 2026

😅 you can actually just push extra commits to your existing branch for #4486. It’ll update that PR automatically so we can keep all these whitespace fixes in one place for Bjorn to review. It saves everyone some clicks if we group them! (let's see what bjorn's take on naming validation idea, though implementing that won't be a cup of tea )

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.

2 participants