stop writing out extra space #332
Merged
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.
I think I tracked down this extra space behavior to here:
ac49870
It was a very long time ago and there's not a good description or tests associated with this commit. My hope is that because this was such an old version of mathquill it was necessary before but isn't necessary anymore. And maybe this pattern proliferated. One thing that gives me this hope is that there's a comparison to
'\\int '(with a trailing space) here:ac49870#diff-7e892af2c012f89c5208ddb22a30e32945144e1d3691ce7c4821d5fa30a73bc6R36
Hoping that this was early enough that handling of space wasn't super robust. And maybe over time handling of space improved so this isn't necessary anymore.
The part that makes me think this probably isn't strictly necessary is that there's already internal code that consumes empty blocks. There's no space in the this
\sqrt{}fragment:https://github.com/desmosinc/mathquill/blob/main/src/commands/math/basicSymbols.ts#L1184