Fix word wrap regression when editing messages #298
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.
#286 addressed some issues with code block display (#285), namely that consecutive spaces were being incorrectly condensed, which mangled the appearance of code or ASCII-style tables emitted by models.
The fix for this (replacing spaces with
when entering edit mode and then reverting that when saving the edit) seems to have introduced an issue wherein while in edit mode, each paragraph is treated as a single long line and breaks oddly. My guess is that the original fix was attempted in order to work around an unresolved ShowdownJS issue in which Showdown's own behavior for handling spaces within codeblocks is a bit broken because it double-encodes them, resulting in spaces being rendered as 
instead of
.This PR fixes the regression while retaining the improved code block handling by working around the ShowdownJS bug, replacing the double-encoded
 
sequences it produces with regular
s.Demonstration of a chat message with both an ASCII table and long lines:
Demonstration of same message rendering successfully after being edited:
Demonstration of edit mode properly breaking the paragraphs underneath the table: