fix: Unescape %% in Text when not using String.format()#332
Open
claudeaceae wants to merge 1 commit intoskiptools:mainfrom
Open
fix: Unescape %% in Text when not using String.format()#332claudeaceae wants to merge 1 commit intoskiptools:mainfrom
claudeaceae wants to merge 1 commit intoskiptools:mainfrom
Conversation
Fixes skiptools#331. Literal % characters in LocalizedStringKey are escaped to %% for Java String.format() safety, but this escaping leaked to display paths that don't use String.format(), causing doubled percent signs in output. This adds unescaping of %% back to % in three code paths: - localizedTextString() when interpolations list is empty - Render() non-markdown path when interpolations is nil - Markdown text/code/link nodes that have no format specifiers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @claudeaceae on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file |
This was referenced Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #331. Literal
%characters inLocalizedStringKeypatterns are escaped to%%for JavaString.format()safety inappendLiteral(), but this escaping leaked to display paths that don't callString.format(), causing doubled percent signs in the output.For example,
Text("Perfect! 100% **bold**")would display asPerfect! 100%% boldon Android because:appendLiteralescapes%→%%in the patternString.format()%%is returned and displayed as-isChanges
This adds
%%→%unescaping in three code paths whereString.format()is not used:localizedTextString()— when the interpolations list is empty (the!interpolations.isEmpty()check skips formatting)Render()non-markdown path — wheninterpolationsis nildisplayString(for:interpolations:)helper that checksinterpolationIndexesto determine ifformattedString()went throughString.format()or returned the raw stringThe unescaping is safe because:
String.format()WAS called, it already converts%%→%, so there are no%%sequences left to unescapeString.format()was NOT called,%%must be unescaped to restore the original%Note
The root escaping in
appendLiteral()is preserved because it's needed whenString.format()IS called (e.g.,Text("100% \(name)")). A deeper refactor could move the escaping to the formatting layer instead, but this targeted fix is lower risk.Test plan
Text("Perfect! 100% **bold**")displays correctly on Android (should show100%not100%%)Text("100% \(name)")with interpolation still works correctlyText("100% done")without markdown displays correctlyText("Use %% for modulo")preserves double percent when intended🤖 Generated with Claude Code