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.
What is broken
words
output formatting is broken, because the lines it outputs are too long:The fix in this PR:
xt_words
doesn't respectMAX_LINE_LENGTH
correctly because at the end of each line it resets the length counter to0
, while the next word is already in memory to be printed on the next line. So effectively, for each line after the first, it starts counting the line length from0
after printing the first word on that line. Instead it needs be set to the length of that first word (plus 1, for a space) so it's taken into consideration when the count continues after that word. This commit resets the counter to the length of the word already in memory (the first word to be printed on the new line), and increments it once to account for the space printed after the word. The length of that word is still on the stack at this point, put there byxt_name_to_string
, so it can be taken directly from there withlda 0,x
, exactly like the routine already does right above when adding the length of the word to the counter.Output after the fix:
Fixes #270