Text selection boundary accumulates extra space after repeated pasting

Open
#1,150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
frontend

Research direction

Reproduce the issue with a text node on the canvas by repeatedly copying and pasting its contents in edit mode. Trace the text width calculation and the selection boundary update, then verify that the left and right gaps remain equal after repeated pastes in Chrome.

Written by the indexing model from the issue text.

Description

area: text bug

Description

When content is pasted repeatedly into a text node, the gap between the right edge of the text selection boundary and the actual end of the text keeps increasing. This appears to be caused by an incorrect text width calculation.

Steps to reproduce

  1. Drag a text node onto the canvas.
  2. Double-click the text node to enter edit mode.
  3. Select all of the current text and copy it.
  4. Place the cursor at the end of the current text.
  5. Paste the copied content repeatedly.
  6. Observe the distance between the right edge of the text selection boundary and the actual end of the text.

Actual behavior

The empty space between the right edge of the text selection boundary and the actual end of the text increases with each paste.

Expected behavior

The distance between the right edge of the selection boundary and the end of the text should remain constant. It should match the distance between the left edge of the selection boundary and the beginning of the text, regardless of how many times content is pasted.

Environment

  • OS: macOS
  • Browser: Chrome
Dominant language
TypeScript
Stars
703
Forks
61
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from worktile/plait

All issues in worktile/plait

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.