Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix word wrap regression when editing messages #298

Merged
merged 1 commit into from
May 3, 2023

Conversation

khanonnie
Copy link
Contributor

@khanonnie khanonnie commented May 3, 2023

#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:
image

Demonstration of same message rendering successfully after being edited:
image

Demonstration of edit mode properly breaking the paragraphs underneath the table:
image

@khanonnie khanonnie marked this pull request as ready for review May 3, 2023 07:53
@sceuick sceuick merged commit 280f570 into agnaistic:dev May 3, 2023
4 checks passed
@khanonnie khanonnie deleted the fix-edit-word-break branch May 3, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants