Commit Graph
1 Commits
Author SHA1 Message Date
David Richardson dc074c89dd AppKit: Add CPTextList and list management to CPTextView
AppKit lacked CPTextList and the textLists property on CPParagraphStyle,
preventing rich text from supporting bulleted or numbered lists. Additionally,
CPTextView derived its typing attributes from the character following the
insertion point upon selection changes, causing text appended at the end of a
document (and the Font Panel) to incorrectly revert to default styling.

* AppKit/CPTextView/CPTextList.j:
  - Implement CPTextList following NSTextList specifications, including standard
    Cocoa marker formats, CPTextListPrependEnclosingMarker, starting item numbers,
    markerForItemNumber:, isOrdered, and keyed archiving.
  - Add rangeOfTextList:atIndex: and itemNumberInTextList:atIndex: category
    extensions to CPAttributedString.

* AppKit/CPTextView/CPParagraphStyle.j:
  - Add textLists and setTextLists: properties with copy and archiving support.
  - Implement paragraph style equality checks based on list identity.

* AppKit/CPTextView/CPTextView.j:
  - Implement setTextList: and the changeTextList: action method (routing marker
    styles via sender tags). Adjacent paragraphs with matching styles join automatically.
  - Implement list item keyboard navigation and editing mechanics: Return generates
    subsequent list items, Return on an empty item terminates list context,
    Tab at item origin nests levels, Shift-Tab promotes levels, and Delete at item
    text origin strips list membership.
  - Automate list item renumbering during live edits, paste operations, and undo/redo cycles.
  - Update Paste Ruler routines to correctly synthesize, strip, and merge list markers.
  - Fix typingAttributes and Font Panel attribute resolution to derive from the
    first selected character or the character immediately preceding the insertion point.

* AppKit/CPKeyBinding.j:
  - Bind Shift-Tab selector to insertBacktab:.

* AppKit/CPWindow/CPWindow.j:
  - Update key event routing to dispatch Shift-Tab to first responders that accept Tab.

* AppKit/AppKit.j:
  - Export CPTextList.

* Tests/AppKit/CPTextListTest.j:
  - Add unit test coverage for marker formatting, archiving, list range queries,
    interactive list editing, Paste Ruler execution, and menu action validation.

* Tests/AppKit/CPTextViewTest.j:
  - Add test coverage verifying typing attributes at trailing insertion points.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, MainMenu.cib:
  - Add Format > List menu structures containing bulleted, numbered, and outline choices.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark list interaction testing as completed; log RTF list serialization as an open item.

CPTextView now provides Cocoa-compliant bulleted, numbered, and nested list support.
2026-10-24 11:33:57 -06:00