Skip to content

When deleting words forward and backward, handle different kinds of whitespace other than regular spaces - #13

Merged
trueadm merged 3 commits into
meta:mainfrom
steveluscher:broader-definition-of-whitespace-for-actions
Jan 20, 2021
Merged

trueadm merged 3 commits into
meta:mainfrom
steveluscher:broader-definition-of-whitespace-for-actions

Conversation

@steveluscher

@steveluscher steveluscher commented Jan 20, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #9.

Repro: Delete from end of line using option-delete.

Before:

Screen.Recording.2021-01-19.at.6.44.59.PM.mov

After:

Screen.Recording.2021-01-19.at.6.45.19.PM.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 20, 2021

@trueadm trueadm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice :)

@trueadm
trueadm merged commit 6fedc48 into meta:main Jan 20, 2021
@trueadm
trueadm deleted the broader-definition-of-whitespace-for-actions branch January 20, 2021 09:59
@steveluscher

Copy link
Copy Markdown
Contributor Author

Nice :)

I don't actually even think this is how it will stay. The right strategy probably has to do with scanning for word boundaries (\b) rather than skipping whitespace (\s). I'll keep working on it!

luantaraschi added a commit to luantaraschi/lexical that referenced this pull request Aug 24, 2026
…aracter reference

A raw destination ends at whitespace and the pointy form is defined
without a line ending, so a URL holding one had no spelling at all.
Export wrote it literally, which left a destination no reader can close
and split the paragraph in two, on `main` as much as here.

It goes out as `&meta#13;` and `&meta#10;` instead, which `unescapeText` already
decodes, so the URL survives the round trip and a CommonMark reader gets
the same one back. `mdast-util-to-markdown` writes the same destination
in its hexadecimal spelling.
etrepum pushed a commit to clean99/lexical that referenced this pull request Oct 29, 2026
…g, add changeset

## Description

On top of the line-ending fix for link titles, `LINK.export` escaped the destination and the title with the same three steps written out twice: character references, the shape's own syntax characters, then line endings as `&meta#13;`/`&meta#10;`. They now go through one `escapeLinkPart(value, syntax)` helper, so the destination and title can't drift apart again, and the comment that explained line endings for the destination alone now covers both. Output is unchanged from the previous commit.

Also adds the changeset for the title fix, with a `Verify:` paragraph since exported Markdown changes for titles that contain a line ending.

## Changeset

`.changeset/escape-line-endings-in-link-titles.md`: `[fix]` for `@lexical/markdown`, with `Verify:`.

## Test plan

### After

```
$ vitest run --project unit packages/lexical-markdown
 Test Files  9 passed (9)
      Tests  785 passed (785)
$ pnpm run check-changesets
Changeset check passed: 6 pending changeset(s) valid.
```

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure that all forms of whitespace (en spaces, em spaces, etc) are handled by the backward/forward word delete functions

3 participants