Skip to content

Editor: an emphasis keeps painting its last path after its range stops laying out #2341

Closed

Description

@datlechin

Behaviour, not a crash. Split out of #2338.

EmphasisManager.updateLayerBackgrounds() skips an emphasis whose makeShapePath returns nil, which leaves that emphasis's CAShapeLayer holding the path it last had. When the range stops laying out, because the text under it was edited or its line was invalidated, the highlight or underline keeps painting at its old position, over whatever text now occupies it.

This is pre-existing for .standard and .outline, where roundedPathForRange already returned nil, and #2338 extends it to .underline.

The arguably correct behaviour is to clear emphasis.layer.path and hide the text layer before skipping, so nothing is drawn when there is nothing to draw. The risk is flicker: an attribute-only edit invalidates lines, so a find highlight could blink off and back on during ordinary syntax highlighting traffic. That needs measuring before it ships, which is why it is not in #2338.

Activity

  1. added
    bug
    on Aug 21, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions