fix: correct index bug in extractCodeBlocks and extractInlineCodes#130
Merged
mengzhuo merged 1 commit intosipeed:mainfrom Feb 13, 2026
Merged
fix: correct index bug in extractCodeBlocks and extractInlineCodes#130mengzhuo merged 1 commit intosipeed:mainfrom
mengzhuo merged 1 commit intosipeed:mainfrom
Conversation
The previous implementation used len(codes)-1 in ReplaceAllStringFunc, which caused all placeholders to point to the same (last) index. This resulted in only the last code block being displayed correctly when multiple code blocks were present in a message. Now using a proper counter variable that increments for each match, ensuring each code block gets a unique placeholder index.
Sri-Bhat
approved these changes
Feb 13, 2026
emadomedher
pushed a commit
to emadomedher/picoclaw
that referenced
this pull request
Feb 17, 2026
fix: correct index bug in extractCodeBlocks and extractInlineCodes
StarWindv
referenced
this pull request
in StarWindv/PicoClaw-shou
Feb 19, 2026
fix: correct index bug in extractCodeBlocks and extractInlineCodes
Contributor
|
@MHCP000 That index bug was a sneaky one, all placeholders pointing to the last code block must have been confusing for users. Good find and clean fix with the counter variable! By the way, we have the PicoClaw Dev Group on Discord for contributors. Want to join? Just email |
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.
The previous implementation used len(codes)-1 in ReplaceAllStringFunc, which caused all placeholders to point to the same (last) index. This resulted in only the last code block being displayed correctly when multiple code blocks were present in a message.
Now using a proper counter variable that increments for each match, ensuring each code block gets a unique placeholder index.