Commit Graph
2129 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 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 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 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 1622990436 AppKit: Draw ruler markers sharply as the triangles the ruler always showed
The new ruler drew tab stops as L-shaped brackets, which differed from the triangles earlier versions showed, and placed marker images at fractional positions, so identical markers drew differently along the ruler.

* CPTextView/CPRulerMarker.j: Round marker image positions to whole points.

* CPTextView/CPTextView.j: Draw tab stops as triangles pointing right for a left tab, left for a right tab and down for a centre or decimal tab, with whole-point image origins.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the ruler and text layout entries fixed in this series, move the remaining nib2cib ruler entry to the nib2cib section, and record the ruler and text width as tested.
2026-10-23 19:52:43 -06:00
David Richardson 00851abfa9 AppKit: Model CPRulerView and CPRulerMarker on NSRulerView and NSRulerMarker
Ruler classes departed from canonical NS versions, resulting in functional and visual gaps.:

markers were views that drew text characters and ignored their location argument, the ruler rebuilt its subviews on every update and had no origin offset, measurement units or reserved thicknesses, and CPTextView updated the ruler only on focus and typing attribute changes, had no ruler control methods, and never showed a right indent marker.

* AppKit.j: Import CPRulerMarker and CPRulerView.

* CPScrollView.j: Tile rulers by their required thickness, and give a ruler its scroll view when it is set.

* CPTextView/CPRulerMarker.j: Add CPRulerMarker as an object drawn by its ruler, with a marker location, an image and image origin, movability and removability, and tracking that adds, moves and removes markers through the client view.

* CPTextView/CPRulerView.j: Rewrite CPRulerView with an origin offset, registered measurement units defaulting to the user's region, reserved thicknesses for markers and an accessory view, Cocoa's client view methods, temporary ruler lines, and drawing in a single pass.

* CPTextView/CPTextView.j: Add usesRuler, isRulerVisible, setRulerVisible: and toggleRuler: with a Show Ruler or Hide Ruler title; update the ruler on every selection change; place tab stop, first line, head and tail indent markers relative to the start of the text, with SVG marker images and a context menu for changing tab types and resetting indents.

* Tests/Manual/TextEditor/DocumentWindowController.j: Show the ruler through setRulerVisible:.
2026-10-23 19:30:48 -06:00
David Richardson 66ea130c8d AppKit: Disable Undo and Redo when a text view does not allow undo
A text view handled undo: and redo: and registered its changes even when allowsUndo was NO, so Edit > Undo stayed enabled and did nothing.

Behaviour now follows canonical Cocoa: a text view that does not allow undo registers nothing and passes undo: and redo: on to the window, and Undo and Redo are enabled only when there is a change to undo or redo.

* CPTextView/CPTextView.j: Register changes only when undo is allowed, stop responding to undo: and redo: when it is not, and validate the Undo and Redo items against the undo manager.

* CPWindow/CPWindow.j: Validate the Undo and Redo items against the window's undo manager.

* Tests/AppKit/CPTextViewTest.j: Add tests for responding to undo:, registering changes and validating the Undo item.

* Tests/Manual/TextEditor/DocumentWindowController.j: Add toggleAllowsUndo: and validateMenuItem:, so that undo can be turned on and off for the active document.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, Resources/MainMenu.cib: Add Edit > Allow Undo.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, record Allow Undo as tested, and add the key equivalent behaviour of disabled menu items for discussion.
2026-10-23 17:20:27 -06:00
David Richardson 947fbaddfa AppKit: Show CPBundleDisplayName as the application's name
AppKit read only CPBundleName for the name that users see, so an application's display name was ignored. It now follows Cocoa, which shows CFBundleDisplayName and falls back to CFBundleName.

* CPApplication.j: Add _applicationName, which returns CPBundleDisplayName or, without one, CPBundleName, and use it as the About panel title.

* CPMenu/_CPMenuBarWindow.j: Use the display name in the browser tab title.

* Tests/Manual/TextEditor/Info.plist: Rename the display name key from CFBundleDisplayName to CPBundleDisplayName.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, and record the About panel as tested.
2026-10-23 16:45:51 -06:00
David Richardson 055ae6d04e AppKit: List the application's windows in the Windows menu
The Window menu never listed the application's windows, because AppKit had none of Cocoa's Windows menu support.

* CPApplication.j: Add windowsMenu, setWindowsMenu:, addWindowsItem:title:filename:, changeWindowsItem:title:filename:, removeWindowsItem:, updateWindowsItem: and arrangeInFront:; find the menu named _CPWindowsMenu in the main menu, and list the visible windows when the main menu is set.

* CPWindow/CPWindow.j: Add isExcludedFromWindowsMenu and setExcludedFromWindowsMenu:, and keep the window's item current when the window is ordered in or out, retitled, made main or no longer main, miniaturized, deminiaturized or closed.

* Tests/AppKit/CPApplicationWindowsMenuTest.j: Add tests for listing, retitling, exclusion, the main window check mark, separator handling, file name titles and moving items to another Windows menu.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, and record the Window menu as tested.
2026-10-23 16:29:46 -06:00
David Richardson 56aa68f832 AppKit: Reflect the toolbar's visibility in the Show Toolbar menu item
The Show Toolbar menu item toggled the toolbar, but CPWindow did not validate it, so its title never changed and it stayed enabled in windows without a toolbar.

* CPWindow/CPWindow.j: Add validateUserInterfaceItem:, which sets the toggleToolbarShown: item's title to Hide Toolbar or Show Toolbar and enables it only when the window has a toolbar.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this defect, and record the menu item as tested.
2026-10-23 16:12:14 -06:00
David Richardson 41969c7f55 Undo functionality: verify behaviour, fix accidentally disclosed edge case
The TextEditor work list recorded redo as unreliable. Retesting proved that undo and redo work correctly.

Supporting investigation disclosed an edge case in CPUndoManager: when undo ran in the same run loop cycle as the change it reverted, it closed the open event grouping itself, but the run loop's scheduled close still ran and raised CPInternalInconsistencyException because no grouping was open.

* Foundation/CPUndoManager.j: Cancel the run loop's scheduled close when undo closes the event grouping itself.
* Tests/Foundation/CPUndoManagerTest.j: Add a test that undoes a change in the same run loop cycle and then redoes it, and correct the doIt selector registered by the undoIt helper.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the redo entry recorded in error, and record undo and redo as tested.
2026-10-23 15:54:19 -06:00
David Richardson c1f8c8ceb3 AppKit: Store the window delegate's resize size in the window frame
A window stored the proposed size in its frame before asking its delegate through windowWillResize:toSize:, and gave the delegate's size only to the window view. When the delegate enlarged the size, hit testing used the smaller frame, so the window could no longer be moved or resized.

* CPWindow/CPWindow.j: Ask the delegate before storing the new size, and store the size it returns in the frame.
* CPWindow/_CPWindowView.j: Ask the delegate during a user resize, and move the origin by the delegate's adjustment when resizing from the left or top edge, so that the opposite edge stays in place.
* Tests/Manual/TextEditor/Resources/DocumentWindow.xib: Make the document window's content view resize with the window.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this defect, record the minimum window size behaviour as tested, and add the content view resizing setting that does not reach the cib.
2026-10-23 15:21:23 -06:00
David Richardson 41a7004a53 Tests/Manual: Record more AppKit gaps in the TextEditor work list
Add the AppKit gaps found since the work list was created, and describe the visible effect of the window resize defect.

* WORKLIST.md: Add entries for CPBundleDisplayName, which AppKit ignores, and for the Show Toolbar menu item, which never reflects the toolbar state; state that a window shrunk to its minimum size can no longer be moved or resized, because hit testing uses the unclamped frame.
2026-10-23 14:52:36 -06:00
David Richardson 98c3611ade Tests/Manual: Name TextEditor TextEdit by Cappuccino
Give TextEditor a display name and a real bundle identifier, and replace the template copyright and author placeholders.

* Info.plist: Set the bundle identifier to dev.cappuccino.TextEditor, add the display name TextEdit by Cappuccino, and state the MIT license in the copyright string.
* Jakefile: Set the same bundle identifier and remove the placeholder email.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Use the display name in the application menu, About and Help items.
2026-10-23 14:41:45 -06:00
David Richardson e3a3cf6bcd Tests/Manual: Remove Internet Explorer markup from TextEditor html launch pages
Remove the conditional comments for Internet Explorer 8 and 9 that the capp gen template added, since no supported browser reads them.

* index.html, index-debug.html: Remove the X-UA-Compatible meta elements and their IE conditional comments.
2026-10-23 14:18:45 -06:00
David Richardson 1944382e0e Tests/Manual: Clamp TextEditor document windows to a minimum size
Stop document windows from shrinking below a usable size, and record the AppKit gaps that TextEditor has found.

* DocumentWindowController.j: Implement windowWillResize:toSize: to keep the window at or above provisional minimum dimensions.
* WORKLIST.md: Add a work list of the AppKit gaps found by TextEditor, the planned additions to the app and the tests done.
2026-10-22 19:05:35 -06:00
David Richardson 24b760b306 Tests/Manual: Declare the TextEditor bundle type and identifier
Add the bundle package type and identifier to the TextEditor Info.plist, so that the build does not have to derive them.

* Info.plist: Add CPBundlePackageType APPL and CPBundleIdentifier.
2026-10-22 19:04:57 -06:00
David Richardson f4109c0ee4 Enable “Undo” functionality
Undo was not enabled in the IB NSTextView attributes.
Enable it.
2026-10-22 16:59:30 -06:00
David Richardson 459a61af58 Tests/Manual: Show a horizontal ruler in the TextEditor document window
Turn on the text view's horizontal ruler in code, because nib2cib does not carry the Interface Builder ruler settings into the cib.

* DocumentWindowController.j: Enable the horizontal ruler on the text view's enclosing scroll view in windowDidLoad, with a comment explaining why it is set up in code.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Remove the Insert Lorem Ipsum key equivalent, which duplicated File > New.
2026-10-22 16:49:29 -06:00
David Richardson 080d9e723e Tests/Manual: Add a text view and Lorem Ipsum insertion to TextEditor
Give the document window a scrolling text view and a toolbar, and add an Edit menu item that inserts placeholder text into the active document.

* LoremIpsum.j: Add a class that supplies the traditional Lorem ipsum passage as static text.
* DocumentWindowController.j: Add a textView outlet and an insertLoremIpsum: action that inserts the placeholder text at the selection through insertText:, so the document's undo manager records it.
* Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Add a text view in a scroll view that resizes with the window, a toolbar with the default items, and the textView outlet connection.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Add an Insert Lorem Ipsum item to the Edit menu that sends insertLoremIpsum: to First Responder.
2026-10-22 16:33:40 -06:00
David Richardson b58be16e8a Tests/Manual: Make TextEditor a document-based application
Move the main window out of MainMenu.xib into a document window owned by a window controller, so that each document opens in its own window.

* Document.j: Add a CPDocument subclass that creates a DocumentWindowController for each document.
* DocumentWindowController.j: Add a CPWindowController subclass that loads DocumentWindow.cib and sets itself as the window's delegate.
* Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Add the document window, with DocumentWindowController as File's Owner.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Remove the window, name the application menu Text Editor, rename Preferences to Settings, and remove Quit.
* AppController.j: Remove the window outlet and the code that made the window fill the browser.
* main.j: Import Document.j.
* Info.plist: Declare the Document type with Document as its document class.
2026-10-22 16:07:56 -06:00
David Richardson 71baddb0be Tests/Manual: Add TextEditor application licensed under MIT
Add a cib-based application generated by capp gen as the foundation for a document-based test application and tutorial, MIT licensed.

* The application is a starting point for new applications, so a permissive license lets developers copy its code into their own work without obligations beyond keeping the notice.
* AppController.j, main.j, Jakefile, index.html, index-debug.html: Replace the template header with an MIT header naming the author as copyright holder.
* main.j: Correct the file name in the header.
* Info.plist, Jakefile: Replace the template author placeholder with the author.
* LICENSE: Add the MIT License text.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Add the template main menu.
2026-10-22 14:57:43 -06:00
David Richardson be8d536565 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-22 12:44:13 -06:00
David Richardson 203bf38b21 AppKit: Size vertical scrollers by scroller style in CPScrollView
CPScrollView's frame and content size calculations sized the vertical scroller with scrollerWidthForControlSize:, passing a scroller style, so it always took the legacy width.

* CPScrollView: Use scrollerWidthInStyle: for the vertical scroller in +contentSizeForFrameSize:… and +frameSizeForContentSize:….
* CPScrollViewTest: Add tests for both methods with a scroller whose widths differ by style.
2026-10-22 12:36:32 -06:00
David Richardson 99b47c9a29 Foundation: Fix CPDecimalAdd overflow sign swap
CPDecimalAdd tested for underflow twice when reporting overflow of two negative operands, so the overflow was never swapped to underflow.

* CPDecimal: Swap CPCalculationOverflow to CPCalculationUnderflow for a negative result, matching CPDecimalSubtract.
* CPDecimalTest: Add a test that the overflow of two negative operands is reported as underflow.
2026-10-22 12:35:00 -06:00
David Richardson b06c70eb65 Tests: Add configure-modern for capp-build frameworks
Manual tests could only be provisioned with the legacy framework builds.

* Manual/Jakefile: Add configure-modern, which links every manual test's Frameworks and Frameworks/Debug to the capp-build package in Build/modern/Frameworks; share the provisioning with configure through provisionFrameworks.
2026-10-20 17:48:51 -06:00
David Richardson 483fff9305 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-20 17:35:13 -06:00
David Richardson 850c348cca Tests: Add SmartFoldersDemo index-debug.html and provision test frameworks
- Add missing index-debug.html entry point to SmartFoldersDemo.
- Update Tests/Manual/Jakefile configure and clobber tasks to link Release and Debug framework variants (Objective-J, Foundation, AppKit, BlendKit) across all manual tests.
- Safeguard symlink replacement logic to correctly handle existing links while protecting physical asset directories.
2026-10-20 16:19:39 -06:00
David Richardson cc5807e568 SmartFoldersDemo: Add target classification keys for capp-build
Defines explicit target type identifiers in Info.plist required by the static compiler.
These keys have no effect on the legacy Node build pipeline.
2026-10-20 15:29:24 -06:00
daboe01 f10eb2e0a5 fixed: CPAlertFirstButtonReturn.. 2026-10-20 18:20:15 +02:00
daboe01 7b2528f7c2 removed: accidentally added zip file 2026-10-19 22:22:33 +02:00
daboe01 1ae6767971 aristo2 fix 2026-10-18 18:12:55 +02:00
daboe01 34b3367468 textcolorfix 2026-10-18 14:54:44 +02:00
daboe01 98ba46872d new: SmartFoldersDemo 2026-10-18 14:32:32 +02:00
David Richardson f1a8b154fc AppKit: Fix CPDOMAvailable read before assignment
CPDOMAvailable was read during load before it was assigned.

* CPCompatibility: Move the CPDOMAvailable assignment ahead of the engine detection, whose AppleWebKit case calls +[CPPlatform isBrowser], which reads it.
* CPCompatibilityTest: Add a test that re-executes CPCompatibility.j with an AppleWebKit user agent and CPDOMAvailable unset, failing on any exception.
2026-10-15 09:26:12 -06:00
David Richardson 7f38fbe7c7 Tests: promote CPDOMDisplayServer.h to a real source file
- the 11 display-server primitives become plain functions in
  Platform/DOM/CPDOMDisplayServer.j; bodies verbatim from the macro
  definitions; the header was force-included into every AppKit
  compilation by the legacy build and invisible to capp-build
- CPView.j, CPImageView.j, _CPDisplayServer.j import the new file;
  this was the last header in either framework
- CPDOMDisplayServerTest: the raw #include replaced by the
  framework-qualified import
2026-10-06 18:50:09 -06:00
David Richardson 7f89b13387 Tests: convert CPLevelIndicatorTest helper macro to direct messages
- the six GET_LEVEL_INDICATOR_SEGMENT call sites become direct
  layoutEphemeralSubviewNamed: messages; the macro was fully
  parameterized with no ambient state
- the segment index is the literal 0 at every site, so the
  concatenation folds to a constant string
- the warning comment about direct ephemeral-subview access is
  retained
2026-10-06 18:33:52 -06:00
David Richardson f69bd6c4ad Tests: convert CPAnimationContextTest UIAssert macro to direct calls
- the seven UIAssert call sites become direct
  [self markTest:_cmd didPass:...] messages, matching the direct
  calls already used elsewhere in the file
- the macro expanded to the same expression using the enclosing
  method's _cmd, which the completion closures capture identically;
  behavior unchanged
2026-10-06 18:31:02 -06:00