Skip to content

Fix multiline strings for .js/.py/.sh - #973

Open
Leonard Hecker (lhecker) wants to merge 1 commit into
mainfrom
dev/lhecker/lsh-multiline
Open

Leonard Hecker (lhecker) wants to merge 1 commit into
mainfrom
dev/lhecker/lsh-multiline

Conversation

@lhecker

@lhecker Leonard Hecker (lhecker) commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Found an entire class of issues! Fixed:

  • Escaped newlines in the 3 languages
  • Deadlock prevention not recognizing that line advancement via
    await input means that it wasn't a deadlock. Previously, this would
    result in two lines of same length to miss colors on the 2nd line.

Comment on lines +219 to +223
const TESTS: &[(&str, &[u8])] = &[
("javascript", include_bytes!("../../../assets/highlighting-tests/javascript.js")),
("markdown", include_bytes!("../../../assets/highlighting-tests/markdown.md")),
("sql", include_bytes!("../../../assets/highlighting-tests/sql.sql")),
];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus changes.

Comment on lines +23 to +25
if /\\/ {
if /$/ { yield string; await input; }
else if /./ {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now properly checks whether we're looking at

"a\b"

or

"a\
b"

Comment on lines -214 to 231
// if input_offset == saved_offset {
// if input_offset == saved_offset && input_line == saved_line {
// input_offset += 1;
// }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a bug in deadlock prevention. await input resets the off on resumption, but this deadlock prevention logic still got the cached offset. To fix it, we need a new line number register such that we can be like [quoted code above].

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.

1 participant