uttrflow / uttrflow/uttrflow-swift

HTML-only clipboard copies discard ordered-list start, item value and reversed numbering

Open
#804 0 comments 0 reactions 0 assignees View on GitHub
bug P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## Problem

`RichTextPlainForm` always starts an ordered list at one and increments it. `PlainTextRenderer.ListFrame` stores only a zero-initialized counter, and `openItem` ignores the parsed `ol start`, `ol reversed`, and `li value` attributes. This changes numbered steps or rankings in the plain text kept for an HTML-only copy.

## Reproductions

| HTML | Expected plain text | Actual plain text |
| --- | --- | --- |
| `

  1. Review
  2. Publish
` | `4. Review` then `5. Publish` | `1. Review` then `2. Publish` |
| `
  1. Review
  2. Publish
` | `7. Review` then `8. Publish` | `1. Review` then `2. Publish` |
| `
  1. Review
  2. Publish
` | `2. Review` then `1. Publish` | `1. Review` then `2. Publish` |

Each row fails both a direct converter assertion and an assertion against the watcher's returned clip. The [HTML Standard](https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element) defines these attributes as controlling list ordinal values; they are not merely font or emphasis styling.

## Reachability and verification limits

Reviewed unmodified main `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`. Verified both the converter and `PasteboardWatcher.newClip(at:)`, supplying HTML with no plain-string or image representation through the existing `FakeClipboard` test seam. The watcher returns a clip whose `text` has the incorrect conversion; its `richText` retains the original HTML. A control with an explicit plain-string representation passes, because that representation bypasses conversion. This is an HTML-only clipboard path, not a claim that all browser copies are affected. No live application clipboard or UI was exercised.

The existing rich-text suites passed in the preceding review pass. The new tests assert expected content independently of the converter.

## Fix and acceptance checks

Preserve the list's starting value, direction, and item-value overrides when rendering plain decimal markers. Keep counters independent across nested lists. Regress the three examples, zero/negative starts, reversed lists with and without an explicit start, item overrides after the first item, and nested lists. Preserve existing empty-item and checklist behavior deliberately.

Code: `Sources/UttrflowClipboard/RichTextPlainForm.swift` (`ListFrame`, `apply`, `openItem`) and `PasteboardWatcher.swift:118-121`. Existing ordered-list tests cover default forward lists, including nesting and counts above nine, but none of these ordinal attributes. #741 concerns coverage of the HTML-only fallback itself; #114 concerns dictation post-processing, not clipboard HTML numbering.

Contributor guide

Open the contributing guide

Research direction

Start in Sources/UttrflowClipboard/RichTextPlainForm.swift, focusing on ListFrame, apply, and openItem, then inspect the PasteboardWatcher.newClip(at:) path at PasteboardWatcher.swift:118-121. Run the existing ordered-list tests and add coverage for the listed ordinal cases, nested lists, and empty-item or checklist behavior. Done means HTML-only clipboard text preserves ordered-list numbering while rich text and explicit plain-string behavior remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.