Commit Graph
11425 Commits
Author SHA1 Message Date
David Richardson 2afea4f8ee Merge pull request #3351 from cappuccino/main-testing
Protect canonical AppKit and Foundation APIs with compatibility tests

Add regression and drop-in compatibility test suites to preserve canonical AppKit and Foundation public contracts and archived behavior, incorporating immediate fixes for defects exposed by the improved tests.
2026-11-02 17:38:50 -06:00
David Richardson a4b3d76da1 Tests: Record dates by instant in the drop-in snapshot
* DropInSnapshot.j:
  - Describe a CPDate by its UTC instant instead of its class name.
  - Record the string value of a control holding a date by the date's instant, since the browser formats it in the local time zone.

* DropInArchives.json: Update the CPDatePicker entry to the instant it archives.

* DropInArchiveTest.j: State that the test must pass in every time zone, and how to check it in UTC.
2026-11-02 17:30:09 -06:00
David Richardson aa4652921a CPPredicate improvement: Parse custom selector comparisons in predicate format strings
Brings format string parsing into line with canonical NSPredicate.

* _CPPredicate: Accept a one-argument selector as a comparison operator.
* CPPredicateTest: Verify parsing and evaluation of custom selector comparisons.
2026-11-02 11:15:27 -06:00
David Richardson 6d38f9f7f6 Merge branch 'jake-clobber-improvements' into main-testing 2026-11-02 11:02:10 -06:00
David Richardson 66eae211bf Merge branch 'cptimezonetest-accommodate-tz-rule-changes' into main-testing 2026-11-02 10:57:55 -06:00
David Richardson 1e979ea2fb Improve Tests: Isolate global scroller style in CPScrollViewTest
* CPScrollViewTest: Save and restore global scroller style in setUp and tearDown.
2026-11-02 10:56:05 -06:00
David Richardson bb3c81bd6b jake clobber target: include framework-specific Build directories
Accommodate Build directories created by capp-build at framework level.
These would otherwise interfere with the Node compiler and orchestration's operation.

* AppKit/Jakefile: Add Build to the clobber target.
* Foundation/Jakefile: Add Build to the clobber target.
2026-11-02 10:40:08 -06:00
David Richardson 3494fddba4 Foundation: Compute time zone abbreviations per date and fix seasonal tests
Ensure time zone results are verified identically on any date and host,
including zones in jurisdictions that have abolished seasonal offset changes,
by asserting against fixed dates in January and July. Abbreviations are
computed for the current date, as in Cocoa.

* CPTimeZone:
  * Compute abbreviation for the current date.
  * Use the computed abbreviation in description.

* CPTimeZoneTest:
  * Assert offsets, abbreviations and daylight saving state at fixed dates.
  * Replace host-dependent and season-dependent assertions.
2026-11-02 09:56:11 -06:00
David Richardson 6ddcfe0d79 AppKit: Protect archiving of non-view objects and add regression tests
Ensure objects held and shared by views are correct by verifying they retain
the properties applications read after archiving.

* CPAppearance: Add the name accessor.

* CPShadow:
  * Add CPCoding.
  * Add init with the default shadow values.

* CPObjectArchivingTest: Verifies round trips of Foundation values, AppKit
  values, and objects that belong to views.

* DropInArchiveTest: State the reasons the MainMenu cibs are not included.
2026-10-31 22:18:28 -06:00
David Richardson 9944659776 AppKit: Protect behaviour of decoded views and add regression tests
Ensure decoded views are correct by verifying they retain their connections and
respond as before archiving.

A decoded table no longer raises, and decoded button bars, tab views, text
fields and outlines retain their observers, selection, delegates and data source
methods.

* CPButtonBar: Observe the hidden state of decoded buttons.

* CPOutlineView: Decode the data source and delegate through their setters.

* CPTableView: Set the data source and delegate after _init during decoding.

* CPTabView: Select the archived tab view item during decoding, before the
  delegate is set.

* CPTextField: Archive the delegate.

* CPViewDecodedBehaviorTest: Verifies connections, the view hierarchy, and the
  behaviour of objects each class creates or observes after decoding.
2026-10-31 22:02:28 -06:00
David Richardson 5e9fb5e363 Tests: Add view theme change regression tests
Protects runtime theme changes by verifying that views resolve the correct
values, and request layout and display, when a theme, state, theme class or
per-view value changes.

* CPViewThemeChangeTest: Verifies resolution order, theme and default theme
  changes, propagation to nested views, state and theme class selection, and
  preservation of per-view values through theme changes and archiving.
2026-10-31 21:39:38 -06:00
David Richardson 34371c1e0f Tests: Add view theme state regression tests
Protects themed drawing by verifying that the states selecting theme values
remain correct as views enter and leave windows and as window status changes.

* CPViewThemeStateTest: Verifies the key window, first responder and appearance
  states across nested views, including views added, removed and moved between
  windows; the key and main states of the window view; and the order of window
  move notifications.
2026-10-31 21:27:07 -06:00
David Richardson fca3a9159a AppKit: Fix outline drop retargeting and add interaction regression tests
Protects the selection, editing and drag and drop contracts of tables and
outlines by verifying the events, delegate calls and data source calls that
applications depend on. A drop retargeted between the children of an item is
delivered to that item.

* CPOutlineView: Set the retargeted drop operation in
  setDropItem:dropChildIndex:.

* CPTableViewInteractionTest: Verify selection by mouse and keyboard, editing,
  drag initiation and drop handling, including refusal and retargeting by the
  delegate and data source.

* CPOutlineViewInteractionTest: Verify dragged items, proposed parents and child
  indexes, drop retargeting, and expansion and its cancellation during a hover.
2026-10-31 21:12:08 -06:00
David Richardson f468d483ff AppKit, Foundation: Fix view archiving and add regression tests
Keyed archiving preserves view hierarchies created in code. Decoded views
retain their content, subviews and state, and each view class is verified
against its own description before archiving.

* CPAccordionView: Add CPCoding to CPAccordionView and CPAccordionViewItem.

* CPBox:
  * Encode the content, title and box views unconditionally.
  * Clear the superviews of the box and title views during decoding.

* CPButton: Initialize the value to CPOffState.

* CPMapTable: Add CPCoding.

* CPPopUpButton: Clear the inherited button value.

* CPSearchField: Update the cancel button when the object value changes.

* CPSplitView: Return nil from dividerColor when the theme defines no divider
  image.

* CPStepper: Discard the decoded buttons before recreating them.

* CPTabView:
  * Encode the current tab view items.
  * Exclude the tabs from the encoded subviews.

* CPTokenField:
  * Discard the decoded scroll view before recreating it.
  * Add the decoded tokens to the new document view.

* CPVisualEffectView: Resolve the backdrop filter property only when a DOM is
  available.

* CPBoxTest: Verify preservation of the content view, hierarchy and title, and
  decoding of an untitled box without warnings.

* CPButtonTest: Verify the initial value of a button.

* CPMapTableTest: Verify preservation of entries through archiving.

* DropInArchiveFixtures: Add populated view fixtures, tree comparison, and
  round trip and saved archive helpers.

* DropInArchiveGenerator: Save cib descriptions and view archives, and write no
  archive data if any view fails its round trip.

* DropInArchiveTest: Verify new archives, saved archives and reference cibs, and
  treat decoding warnings as failures.

* DropInSnapshot:
  * Describe the view hierarchy through private views, with state and content.
  * Add DropInWithFixedScrollerStyle.

* DropInArchives, DropInCibs: Add saved view archives, cib descriptions and
  reference cibs.
2026-10-31 20:51:13 -06:00
David Richardson 5db5adac04 Tests: Add CPButtonBar regression tests
Protects the add, remove and action controls placed below table and outline views by verifying that a button bar supplies usable buttons independently of the active theme.

* CPButtonBarTest: Verifies the standard size of the plus, minus and
  action popup buttons; button placement within the bar, order and
  shared borders; closure of the gap left by a hidden button; right
  edge alignment of right buttons; and acceptance of application
  buttons.
2026-10-31 19:50:31 -06:00
David Richardson e3bb38134b Tests: Improve drop-in snapshot and regenerate baseline
The drop-in baseline preserves framework backward-compatibility contracts by recording expected defaults and states.
Explicit value comparisons are enforced and omitted snapshot entries are reported to detect unintended default modifications.

* DropInSnapshot:
  * Record booleans, numbers and strings by value.
  * Serialize plain objects with sorted keys, and record functions
    and circular references without raising an exception.
  * Extract DropInViewState, and isolate each getter so that an
    exception leaves the remaining state intact.
  * Add throwIfError, so that a generator does not save an exception
    as expected state.
  * Add a skipped list that names each class or window style left out
    of a snapshot.
  * Add DropInCibTree, with view, menu and object descriptions and a
    cib owner, to describe the objects a cib produces.
* DropInBaselineGenerator: Pass throwIfError and print each skipped
  entry.
* DropInBaseline: Regenerate with recorded values and sorted keys.
2026-10-31 19:45:45 -06:00
David Richardson fcf94a5df2 Tests: Add CPOutlineView row content regression tests
Protects custom row rendering by verifying that content remains synchronized and current through standard operational cycles.

* CPOutlineViewRowContentTest: Verifies that selection changes, scrolling, column resizing and hiding, item expansion and collapse, data reloads, and grid or row style modifications trigger complete redraws for visible rows; ensures row content remains unoccluded and idle tables do not execute redundant redrawing.
2026-10-31 16:42:22 -06:00
David Richardson 17198938e0 Tests: Add regression test suites for table drawing and drop-in compatibility
Adds targeted test infrastructure and validation checks to protect table drawing hooks and drop-in framework contracts against unintended modifications.

* CPTableViewDrawingTest: Verifies subclass invocation order for drawing steps and ensures application-specified background colors persist across theme-state changes.

* DropInCompatibilityTest: Validates default theme names, window control configurations, pop-up button bezel styles, and table class defaults.

* DropInSnapshot: Encapsulates theme attribute defaults, public API surface, default view construction, and window controls as structured data.

* DropInBaselineGenerator: Provides tooling to capture current framework state as a baseline.

* DropInBaselineTest: Compares framework artifacts against the established baseline, permitting additions while reporting modifications and removals.

* DropInBaseline.json: Introduces the initial compatibility baseline artifact.
2026-10-31 15:58:31 -06:00
David Richardson 2aeed8c80d Merge pull request #3350 from enquora/integration-test-document-based-app
Merge TextEditor: zoom and CPScrollView magnification

* AppKit: Add NSScrollView's magnification API to CPScrollView. A view
  whose scale returns to 1.0 now drops its CSS scale. Scroll views from
  cibs compiled by nib2cib can now zoom.

* TextEditor: View > Zoom Level, Zoom In, Zoom Out and Actual Size, from
  25% to 200%, as a test of view scaling for the Aristo3 merge. The work
  list records the scaling defects found as open.
2026-10-24 17:59:46 -06:00
David Richardson dc6bebd7eb AppKit: Add magnification support to CPScrollView and zoom controls to TextEditor
CPScrollView previously lacked magnification support, preventing document
zooming and leaving view scaling infrastructure without practical test coverage.
Additionally, views resetting to a 1.0 scale retained stale CSS transform properties,
and legacy cibs compiled via nib2cib omitted explicit magnification limits,
breaking zoom functionality in older archives.

* AppKit/CPScrollView.j:
  - Implement magnification methods and properties (`magnification`, `setMagnification:`, `setMagnification:centeredAtPoint:`, `allowsMagnification`, `minMagnification`, and `maxMagnification`) modelled on NSScrollView, with keyed archiving.
  - Scale clip view bounds and synchronize resizing document view widths.
  - Define standard Cocoa default limits (0.25 and 4.0) as named constants.
  - Implement robust decoding validation to assign default limits to unset or invalid archive values and reject non-positive magnification inputs, ensuring full compatibility with legacy cibs.

* AppKit/CPView.j:
  - Remove stale CSS scale styling when a view's scale factor returns to 1.0.

* Tests/AppKit/CPScrollViewTest.j:
  - Add comprehensive unit tests covering magnification scaling, archiving, and fallback decoding for unconfigured limits.

* Tests/Manual/TextEditor/DocumentWindowController.j:
  - Implement zoom action handlers (`zoomToLevel:`, `zoomToActualSize:`, `zoomIn:`, and `zoomOut:`) driven by menu item tag values.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, MainMenu.cib:
  - Add View menu options for Actual Size, Zoom In, Zoom Out, and explicit Zoom Levels (25% to 200%).

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark zoom functionality as tested; log discovered scaling edge cases as open items.

CPScrollView and TextEditor now support robust document magnification from 25% to 200%, validating core view scaling mechanics.
2026-10-24 17:57:21 -06:00
David Richardson a7ac7fd3b1 Merge pull request #3349 from enquora/integration-test-document-based-app
Merge TextEditor fixes: attachments wider than the text

* AppKit: An attachment wider than the text container keeps its line's
  height and baseline. A table in a narrowed window was drawn above its
  line, over the preceding text.
2026-10-24 15:58:15 -06:00
David Richardson 9b5a0fbbfb AppKit: Maintain proper line height for overflowing attachments in CPTypesetter
When text attachments (such as tables or wide images) exceeded container width,
`CPTypesetter` correctly forced a line break following the attachment but
erroneously reverted the line's height and baseline to pre-attachment metrics.
Consequently, oversized attachments rendered on the baseline of preceding text,
causing them to overlap and obscure content above them in narrowed viewports.

* AppKit/CPTextView/CPTypesetter.j:
  - Update line layout logic to incorporate attachment dimensions into line height
    and baseline calculations when line breaks encompass overflowing attachments.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark wide/overflowing table layout tests as completed.

Attachments and tables wider than the text container now correctly occupy their own distinct lines without overlapping preceding content.
2026-10-24 15:55:54 -06:00
David Richardson b05c912109 Merge pull request #3348 from enquora/integration-test-document-based-app
Merge TextEditor fixes: attachments move with their lines

* AppKit: When unchanged lines below an edit are kept and moved, their
  attachment views and text spans now move on the screen at once. A
  table pasted together with images was shown at the wrong position
  until a scroll or resize.
2026-10-24 15:36:28 -06:00
David Richardson 91cd92f92f AppKit: Correct screen positioning for rescued line fragment views and spans during edits
When CPLayoutManager retained and repositioned unchanged line fragments
below an edit, `_CPLineFragment` incorrectly modified attachment view frames
directly and assigned an unused property to text spans. Consequently, moved
views remained visually stationary on screen because subsequent layout-pass
`setFrameOrigin:` calls detected matching origins, causing asynchronously loaded
elements (such as pasted tables combined with images) to render at incorrect
offsets until forced by a scroll or resize event.

* AppKit/CPTextView/CPLayoutManager.j:
  - Update attachment view relocation to correctly trigger `setFrameOrigin:`.
  - Shift rendered text spans via their style coordinate top properties.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark composite paste workflows (text containing both images and tables) as tested.

Attachment views and text spans now immediately track their corresponding line fragments when text is inserted or modified above them.
2026-10-24 15:34:32 -06:00
David Richardson ec357f1a77 Merge pull request #3347 from enquora/integration-test-document-based-app
Merge TextEditor fixes: lists and Unicode in RTF, images in pasted text

* AppKit: The RTF producer and parser carry text lists, in Cocoa's form
  and readable from Word's, Unicode characters, and the first line indent
  relative to the left indent.

* AppKit: Copy and paste within an application keeps images, tables and
  lists, through the internal archive. Tables can now be archived.

* TextEditor: The work list records that browsers deliver only plain
  text to native applications, so rich text for them needs HTML.
2026-10-24 14:42:41 -06:00
David Richardson 2b77b98163 AppKit: Add RTF list and Unicode support, and preserve rich content during internal copy-paste
The RTF producer and parser lacked support for text lists, failed to encode
non-ASCII characters properly (\uN), and treated first-line indents (\fi) as
absolute values rather than offsets relative to left indents (\li).
Additionally, paste operations ingested application-generated RTF rather than
the native internal archive, causing image attachments and tables to be stripped
during copy-paste workflows within the application.

* AppKit/CPTextView/_CPRTFProducer.j:
  - Implement RTF serialization for text lists using list tables, override tables,
    \levelmarker, \levelprepend, \lsN\ilvlK tags, and \listtext marker blocks.
  - Encode non-ASCII characters via \uc0\uN syntax and compute \fi indents
    relative to \li.
  - Omit image attachment characters from text runs and adjust run starting indices
    to accommodate list markers.

* AppKit/CPTextView/_CPRTFParser.j:
  - Implement pre-pass parsing for list and override tables.
  - Assign shared text lists to items using \ls and \ilvl, extracting marker formats
    from \levelmarker or standard number/level definitions.
  - Parse \uN sequences (skipping fallback characters) and evaluate relative \fi offsets.

* AppKit/CPTextView/CPTextView.j:
  - Configure paste handling to prioritize internal archives when clipboard RTF
    originates from the application, ensuring image attachments and tables survive internal copy-paste.

* AppKit/CPTextView/_CPTableTextAttachment.j:
  - Implement keyed archiving and decoding for table headers, rows, widths,
    and configuration settings, reconstructing cell instances upon unarchiving.

* Tests/AppKit/CPRTFTest.j:
  - Add comprehensive unit tests covering Unicode encoding, relative first-line indents,
    TextEdit and Word list interoperability, and nested list round-trip fidelity.

* Tests/AppKit/CPTextAttachmentTest.j:
  - Add test coverage for table attachment archiving.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark intra-application copy and paste testing as completed.
  - Log external rich text exchange limitations as open items.

Intra-application copy and paste now fully preserves images, tables, and lists,
while RTF serialization supports Unicode and structured hierarchical lists.
2026-10-24 14:37:57 -06:00
David Richardson 3282323053 Merge pull request #3346 from enquora/integration-test-document-based-app
Merge TextEditor: table demonstration

* TextEditor: Edit > Insert Table Example inserts a sample document with
  a table, built from Markdown by CPMarkdownParser. It demonstrates the
  existing table support in a real document. The work list records the
  remaining table checks and known gaps.
2026-10-24 13:18:27 -06:00
David Richardson 29715948cc TextEditor: Add table demonstration sample via CPMarkdownParser
TextEditor lacked a mechanism to showcase or test CPMarkdownParser's
table rendering capabilities within a live document context.

* Tests/Manual/TextEditor/TableExample.j:
  - Add a Markdown sample containing a heading, a formatted table with a header row and styled cells, and accompanying text, converted to an attributed string via CPMarkdownParser.

* Tests/Manual/TextEditor/DocumentWindowController.j:
  - Implement insertTableExample: action to insert the table sample at the current selection.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, MainMenu.cib:
  - Add Edit > Insert Table Example menu item.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Record table rendering as tested; log interactive validation and known table limitations as open items.

TextEditor now provides a live demonstration and testing baseline for rich text table layouts.
2026-10-24 13:13:40 -06:00
David Richardson 69a8d95fbb Merge pull request #3345 from enquora/integration-test-document-based-app
AppKit: Apply font changes without a selection to CPTextView typing attributes

When no text was selected, CPTextView's changeFont: implementation 
erroneously extracted the font to convert from the text storage at the 
insertion point rather than from current typing attributes. Consequently, 
repeated adjustments like Bigger or Smaller failed to accumulate, blank 
document font sizing remained locked after one step, and output arguments 
risked overwriting selection state.

* AppKit/CPTextView/CPTextView.j:
  - Update changeFont: to derive and convert fonts directly from typing 
    attributes when no selection is active, and post corresponding typing 
    attribute update notifications.
  - Eliminate selection range output arguments that could inadvertently 
    modify active selection bounds.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests verifying that repeated font modifications accumulate correctly 
    at zero-length insertion points.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark Bigger and Smaller actions without a selection as tested.

Bigger and Smaller menu commands now correctly compound font size adjustments for subsequent typed text, matching Cocoa behavior.
2026-10-24 13:00:50 -06:00
David Richardson befbbb9c3b AppKit: Apply font changes without a selection to CPTextView typing attributes
When no text was selected, CPTextView's changeFont: implementation
erroneously extracted the font to convert from the text storage at the
insertion point rather than from current typing attributes. Consequently,
repeated adjustments like Bigger or Smaller failed to accumulate, blank
document font sizing remained locked after one step, and output arguments
risked overwriting selection state.

* AppKit/CPTextView/CPTextView.j:
  - Update changeFont: to derive and convert fonts directly from typing
    attributes when no selection is active, and post corresponding typing
    attribute update notifications.
  - Eliminate selection range output arguments that could inadvertently
    modify active selection bounds.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests verifying that repeated font modifications accumulate correctly
    at zero-length insertion points.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark Bigger and Smaller actions without a selection as tested.

Bigger and Smaller menu commands now correctly compound font size adjustments for subsequent typed text, matching Cocoa behavior.
2026-10-24 12:59:18 -06:00
David Richardson 8c30016f3d Merge pull request #3344 from enquora/integration-test-document-based-app
Merge TextEditor fixes: images in text

* AppKit: Add CPTextAttachment, modelled on NSTextAttachment and drawn by
  a view, as in TextKit 2. Images are inserted with Edit > Insert Image…
  or pasted with Command-V, fit the width of the text, and scale with the
  window. Existing view attachments, such as tables, are unchanged.

* AppKit: A resizable CPTextView fits its height to its last character,
  so an image at the end of the text is not clipped.

* TextEditor: The work list records the untested image cases, file drops,
  and image formats in RTF and Markdown as open.
2026-10-24 12:52:48 -06:00
David Richardson e8eaed2e1f AppKit: Correct vertical sizing calculation for resizable CPTextView instances
Vertically resizable CPTextView instances previously calculated frame heights
using metrics from the first character, second-to-last character, and extra
line fragment, omitting the bounding box of the final character. Consequently,
trailing elements such as bottom-anchored image attachments were clipped,
and vertical scroll bars failed to match content bounds following scaling
or layout updates.

* AppKit/CPTextView/CPTextView.j:
  - Include the final character's bounding rectangle when computing view height to fit text.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark wide image fitting tests as completed.

CPTextView containers now fully display trailing content and maintain accurate vertical scroll bar scaling.
2026-10-24 12:50:16 -06:00
David Richardson df78974183 AppKit: Add CPTextAttachment and image support to CPTextView
AppKit lacked a public text attachment class, preventing rich text documents
from embedding or inserting images.

* AppKit/CPTextView/CPTextAttachment.j:
  - Implement CPTextAttachment (modelled on NSTextAttachment) supporting
    initialization via data and file type, contents, file types, images,
    bounds, and keyed archiving.
  - Adopt a TextKit 2-style view rendering architecture that scales images
    to fit text container width and triggers layout updates upon asynchronous loading.

* AppKit/CPTextView/CPTextStorage.j:
  - Update attributedStringWithAttachment: to accept CPTextAttachment instances
    alongside direct views, routing rendering through existing attachment pathways.

* AppKit/CPTextView/CPTextView.j:
  - Implement the insertImage: action (invoking browser file pickers) and
    Command-V paste handling for images.
  - Configure inserted attachments with responsive view instances scaled to
    text width, omitting live views during pasteboard archiving.

* AppKit/CPTextView/CPTextContainer.j:
  - Adjust attachment bounds to match updated container widths during layout invalidation.

* AppKit/AppKit.j:
  - Export CPTextAttachment.

* Tests/AppKit/CPTextAttachmentTest.j:
  - Add test coverage for data URLs, archiving, width scaling, insertion,
    and serialized text output.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, MainMenu.cib:
  - Add Edit > Insert Image… menu item.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark image insertion testing as completed; log remaining image tasks as open.

Rich text documents now support embedded images inserted via file selection or clipboard paste.
2026-10-24 12:34:51 -06:00
David Richardson 96cf42c763 Merge pull request #3343 from enquora/integration-test-document-based-app
AppKit: Integrate Edit menu clipboard actions with the system clipboard

CPTextView previously relied solely on browser clipboard events triggered by 
keyboard equivalents, isolating Edit menu actions (Copy, Paste) to an internal 
pasteboard. Consequently, menu operations ignored external system clipboard 
modifications, and Command-V could mistakenly paste stale internal rich text 
following an external copy operation.

* AppKit/CPTextView/CPTextView.j:
  - Distinguish menu- and button-driven clipboard actions from browser keyboard event handlers.
  - Implement asynchronous Clipboard API integration to write plain text to the system clipboard on copy/cut and read external content for Paste and Paste as Plain Text.
  - Implement intelligent clipboard reconciliation: preserve internal rich text if the system clipboard plain text matches, or ingest external system clipboard text (including for Command-V shortcuts).
  - Ensure Cut operates correctly across all input vectors.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests verifying text ingestion and pasting from the system clipboard.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark Edit menu clipboard synchronization as tested.
  - Log rich-text serialization over the asynchronous Clipboard API as an opportunity for future improvement.

Copy, Cut, and Paste operations from the Edit menu now seamlessly exchange plain text with external applications.
2026-10-24 11:57:24 -06:00
David Richardson 8a70822a2f AppKit: Integrate Edit menu clipboard actions with the system clipboard
CPTextView previously relied solely on browser clipboard events triggered by
keyboard equivalents, isolating Edit menu actions (Copy, Paste) to an internal
pasteboard. Consequently, menu operations ignored external system clipboard
modifications, and Command-V could mistakenly paste stale internal rich text
following an external copy operation.

* AppKit/CPTextView/CPTextView.j:
  - Distinguish menu- and button-driven clipboard actions from browser keyboard event handlers.
  - Implement asynchronous Clipboard API integration to write plain text to the system clipboard on copy/cut and read external content for Paste and Paste as Plain Text.
  - Implement intelligent clipboard reconciliation: preserve internal rich text if the system clipboard plain text matches, or ingest external system clipboard text (including for Command-V shortcuts).
  - Ensure Cut operates correctly across all input vectors.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests verifying text ingestion and pasting from the system clipboard.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark Edit menu clipboard synchronization as tested.
  - Log rich-text serialization over the asynchronous Clipboard API as an opportunity for future improvement.

Copy, Cut, and Paste operations from the Edit menu now seamlessly exchange plain text with external applications.
2026-10-24 11:55:37 -06:00
David Richardson a06ad56545 Merge pull request #3342 from enquora/integration-test-document-based-app
Merge TextEditor fixes: text lists

* AppKit: Add CPTextList and textLists in CPParagraphStyle, modelled on
  Cocoa. CPTextView supports bulleted, numbered and nested lists, with
  Cocoa's editing behaviour for Return, Tab, Shift-Tab and Delete, and
  numbering that follows each change. Paste Ruler carries lists.
* AppKit: Typing attributes and the font panel take the style of the
  character before the insertion point, as in Cocoa.
* AppKit: Shift-Tab reaches a text view that takes the Tab key, and is
  bound to insertBacktab:.
* TextEditor: Format > List applies list styles. The work list records
  RTF support for lists as open.
2026-10-24 11:36:44 -06:00
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
David Richardson 115aae74fe Merge pull request #3341 from enquora/integration-test-document-based-app
Merge TextEditor fixes: Copy Style and Paste Style

* AppKit: CPTextView implements Cocoa's copyFont: and pasteFont:, with
  undo and menu validation. Choosing Copy Style or Paste Style no longer
  raises an exception and leaves the menu unresponsive.
* TextEditor: The work list records Copy Style and Paste Style as tested.
2026-10-24 10:38:29 -06:00
David Richardson 178a7d2aec AppKit: Add Copy Style and Paste Style to CPTextView
CPTextView lacked implementations for copyFont: and pasteFont:
(declared as abstract methods in CPText), causing standard Copy Style and Paste Style menu items to trigger exceptions when invoked.

* AppKit/CPTextView/CPTextView.j:
  - Implement copyFont: to copy character attributes (excluding paragraph style, matching Cocoa) of the initial selection character or current typing attributes to the font pasteboard.
  - Implement pasteFont: to apply copied character attributes to the selection or typing attributes with undo support, preserving individual paragraph styles.
  - Update menu validation logic to enable Copy Style in rich text and Paste Style in editable rich text when the font pasteboard contains valid styling.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests covering style copying and pasting with and without active selections.
  - Add test coverage for menu validation.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Record Copy Style and Paste Style as tested.

Copy Style and Paste Style now function consistently with Cocoa.
2026-10-24 10:36:58 -06:00
David Richardson 9d1504704f Merge pull request #3340 from enquora/integration-test-document-based-app
Merge TextEditor fixes: justified text alignment

* AppKit: CPTypesetter justifies wrapped lines and aligns centred,
  right-aligned and justified text between the paragraph indents.
  Spaces at the end of a wrapped line hang outside the alignment.

* TextEditor: The work list records the limited quality of greedy line
  breaking for justified text as an opportunity for improvement.
2026-10-24 10:19:36 -06:00
David Richardson bb1cd85466 AppKit: Add justified text alignment to CPTypesetter
CPTypesetter lacked handling for CPJustifiedTextAlignment, causing justified paragraphs to fall back to left alignment. Additionally, centred and  right-aligned text improperly spanned the full container width by ignoring  paragraph indents, and trailing spaces on wrapped lines incorrectly shifted  line positioning.

* AppKit/CPTextView/CPTypesetter.j:
  - Implement CPJustifiedTextAlignment layout by distributing spare width  evenly across line spaces.
  - Preserve left alignment for paragraph final lines and segments preceding a tab, matching Cocoa behavior.
  - Constrain centred, right-aligned, and justified lines between head and tail indents.
  - Exclude trailing spaces from visible line width to allow proper hanging alignment.

* AppKit/CPTextView/CPLayoutManager.j:
  - Update _CPLineFragment to record extra space widths and render spans with matching CSS word-spacing.
  - Ensure fragment equality checks account for word-spacing variations.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Mark justified and centred text layout tests as completed.

Centred and justified paragraphs now conform to standard Cocoa layout behavior.
2026-10-24 10:17:42 -06:00
David Richardson f01d83204e Merge pull request #3339 from enquora/integration-test-document-based-app
Merge TextEditor fixes: superscript, subscript and baseline management

* AppKit: CPTextView implements Cocoa's superscript:, subscript:, unscript:,
  raiseBaseline: and lowerBaseline: actions, with undo and menu validation.

* TextEditor: The work list documents text layout and records the Justify
  crash, kerning and ligature settings, and font panel as open items.
2026-10-24 09:46:52 -06:00
David Richardson cc120e514a AppKit: Add superscript, subscript, and baseline management to CPTextView
CPTextView lacked the superscript:, subscript:, unscript:, raiseBaseline:, and lowerBaseline: action methods.
Consequently, standard Baseline menu items targeting these actions were automatically disabled,
even though CPTypesetter and _CPLineFragment already possessed full layout support for baseline offset and superscript attributes.

* AppKit/CPTextView/CPTextView.j:
  - Implement superscript:, subscript:, unscript:, raiseBaseline:, and lowerBaseline:.
  - Apply attribute modifications to selected ranges or current typingAttributes.
  - Register baseline operations with CPUndoManager.
  - Implement menu validation logic to enable baseline actions only when the text view is editable and richText is true.

* Tests/AppKit/CPTextViewTest.j:
  - Add unit tests for superscript levels and baseline offsets across text ranges and typing attributes.
  - Add test coverage for menu validation.

* Tests/Manual/TextEditor/WORKLIST.md:
  - Remove resolved baseline management entry.
  - Expand documentation on text layout and line fragment drawing.
  - Document open items: Justify crash, kerning/ligature settings, and Font Panel integration.
  - Note optimal line breaking as a candidate feature for future improvement.
2026-10-24 09:44:06 -06:00
David Richardson 92900159cc Merge pull request #3338 from enquora/integration-test-document-based-app
Merge TextEditor fixes: ruler settings from Interface Builder, Copy and Paste Ruler

Gaps exposed by the TextEditor test application:

* AppKit, nib2cib: A text view's Uses Ruler setting now comes from Interface Builder, and text views, rulers and ruler markers archive their ruler state.

* AppKit: A dragged ruler marker follows the pointer off the ruler and is removed when released there.

* AppKit: Copy Ruler and Paste Ruler copy a paragraph's indents and tab stops to other paragraphs, and ruler changes can be undone.
2026-10-23 21:53:46 -06:00
David Richardson 62f699e376 AppKit: Add Copy Ruler and Paste Ruler, and undo for ruler changes
CPTextView had no copyRuler: or pasteRuler:, so Format > Text > Copy Ruler and Paste Ruler did nothing, and ruler changes could not be undone. It now follows Cocoa: Copy Ruler puts the paragraph style at the selection on the ruler pasteboard, Paste Ruler applies it to the selected paragraphs, and every ruler change is registered with the undo manager.

* CPPasteboard.j: Add CPRulerPboardType.

* CPTextView/CPTextView.j: Add copyRuler: and pasteRuler: with validation for rich text; register ruler paragraph style changes with the undo manager; refresh the ruler after a replacement.

* Tests/Manual/TextEditor/WORKLIST.md: Record Copy Ruler and Paste Ruler as tested, and add the Copy Style and Paste Style exception.
2026-10-23 21:49:41 -06:00
David Richardson 8e4742a250 AppKit: Carry Interface Builder's Uses Ruler setting into cibs
nib2cib ignored the text view's Uses Ruler setting, and CPTextView, CPRulerView and CPRulerMarker archived none of their ruler state, so a ruler could not be configured in Interface Builder or survive archiving.

* CPScrollView.j: Set itself as the scroll view of decoded rulers.

* CPTextView/CPRulerMarker.j: Archive the marker's ruler, location, image and image origin, movability, removability and represented object.

* CPTextView/CPRulerView.j: Archive the ruler's orientation, client view, accessory view, markers, thicknesses, origin offset and measurement units.

* CPTextView/CPTextView.j: Archive usesRuler.

* Tools/nib2cib/NSTextView.j, Tools/nib2cib/NSTextViewSharedData.j: Read the Uses Ruler flag.

* Tests/AppKit/CPRulerViewTest.j: Add tests for ruler layout, measurement units, archiving and the Uses Ruler setting.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, Resources/MainMenu.cib: Add the standard Format menu, whose Text submenu shows and hides the ruler.

* Tests/Manual/TextEditor/Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Rebuild the cib with the ruler setting, and adjust the window's initial position.
2026-10-23 21:10:17 -06:00
David Richardson 40460f8d95 Merge pull request #3337 from enquora/integration-test-document-based-app
Gaps exposed by the TextEditor test application and fixed:

* AppKit: CPRulerView and CPRulerMarker now follow NSRulerView and NSRulerMarker, and CPTextView gains Cocoa's ruler control methods, a right indent marker and ruler updates on every selection change.

* AppKit: An editable text view now receives the Tab key, and decimal tab stops align on the decimal separator.

* AppKit: Text layout applies Cocoa's line fragment padding, and a tracking text container fits inside the text view's inset.
2026-10-23 20:45:54 -06:00
David Richardson e88313e34f AppKit: Let a dragged ruler marker follow the pointer off the ruler
A removable marker counted as off the ruler only 16 points beyond its edge, and stayed on its line while dragged off, so a tab stop dragged up off the ruler gave no sign of removal and was not removed on release.

It now follows Cocoa behaviour: the marker stays on its line while the pointer is on the ruler, follows the pointer out over the ruler's outer edge where the ruler clips it, and is removed when released off the ruler.

* CPTextView/CPRulerMarker.j: Reduce the removal distance from 16 points to zero; offset the marker across the ruler as the pointer moves outward during a drag, and draw it faded only when dragged off the inner edge.

* Tests/Manual/TextEditor/WORKLIST.md: Record the marker appearance and vertical alignment as interim until Aristo3, and the drag behaviour in each direction.
2026-10-23 20:42:20 -06:00
David Richardson d605ee9d50 AppKit: Align decimal tab stops on the decimal separator
The typesetter laid a decimal tab stop out like a left tab, so a column of numbers started at the stop instead of aligning on its decimal separators. It now follows Cocoa: the first decimal separator of the user's locale starts at the stop, and a segment without one ends at the stop.

* CPTextView/CPTypesetter.j: Position text after a decimal tab stop by the width before its first decimal separator, taken from the browser's locale.

* Tests/Manual/TextEditor/WORKLIST.md: Record the Tab key and the four tab stop types as tested, and the tab stop menu as working.
2026-10-23 20:21:32 -06:00
David Richardson b222ee0320 AppKit: Let an editable text view take the Tab key
CPWindow handled every Tab key press itself and moved to the next key view, so a text view never received Tab and could not insert a tab character.

It now follows Cocoa: an editable text view takes plain Tab and inserts a tab, while Control-Tab, Shift-Tab and Tab in other views still move through the key view loop.

* CPResponder.j: Add _wantsTabKey, which returns NO by default.

* CPTextView/CPTextView.j: Want the Tab key while editable.

* CPWindow/CPWindow.j: Pass plain Tab to a first responder that wants it, and keep the browser from moving its own focus.
2026-10-23 20:20:51 -06:00