Skip to content

macOS read-back: an ending Return's placeholder can make a doubled Return confirm when the field holds one #618

Backlog

Description

@SSFSKIM

Problem

cua's macOS read-back confirms type_text by reading the field back, through confirm in native/engine/Sources/Engine/TypeReadback.swift. Safari's contenteditable reports an ending Return as "\n\n": the Return plus the empty last line's placeholder. confirm handles that case only in one direction, accepting expected + "\n" with caret evidence (readbackPlaceholderLine, ~L200–209; the placeholderLine outcome ~L793–880, ruling 1ea561bc:737 on #354, run 43752829833).

The inverse case is not covered. Take a request ending in two Returns ("x\n\n") where the field accepted only the first. Safari then exposes "x\n" plus its placeholder, which reads as "x\n\n" with the caret at 2. That raw value equals the expected text, so confirm's direct-equality branch accepts it without looking at the caret. It reports success, and the model believes a Return landed that the field does not hold.

The case was found in #616's review, round 3, where the same equality made an inputSourceChanged stop report an exact count. #616 guards its own stop path (ruling 1298). This ticket is the ordinary, non-stop path.

What is known

So by ruling 1298's test this does not block #506.

Wanted

When the expected text ends in "\n", confirm accepts the direct-equality reading only with caret evidence that the caret sits after the final Return, the same evidence the placeholder rule already uses. Otherwise the result is unconfirmed (the existing reason). Add a test: "x\n\n" expected, "x\n\n" read with the caret at 2, which must not confirm.

Board

Bug, P2. Parent #117. Relates to #616 and #354. Not a #506 blocker.

Sminos-Session: cursor235#b93055dd (cua on macbook)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P2status:ready-for-implementer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions