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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
CPTextContainer's line fragment padding was 0 and the typesetter never applied it, so text started 2 points from the text view's edge and ruler markers at 0 were cut off. It now follows Cocoa, with a default padding of 5 points at each end of every line fragment.
* CPTextView/CPTextContainer.j: Default the line fragment padding to 5 points, and archive it.
* CPTextView/CPTypesetter.j: Lay lines out inside the padding: offset line fragment origins by it, compute the right margin, right indent, centred and right alignment within the width inside it, and subtract it when layout resumes from a stored line fragment.
* CPTextView/CPTextView.j: Start the caret in empty text inside the padding.
A text container that tracked its text view's size took the text view's full width, while the text started after the text container inset, so lines could run past the visible right edge.
It now follows Cocoa: a tracking container fills the text view minus the inset on both sides.
* CPTextView/CPTextContainer.j: Subtract the text container inset on both sides when tracking the text view's width and height.
* CPTextView/CPTextView.j: Refit the text container when a text view is created and when its text container inset changes.
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:.
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.
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.
Gaps exposed by the TextEditor test application and fixed in AppKit, Foundation:
* Foundation: CPUndoManager no longer raises when undo runs in the same run loop cycle as the change it reverts.
* AppKit: The Show Toolbar menu item now reflects the toolbar's visibility.
* AppKit: The Window menu now lists the application's windows, marks the main window and supports Bring All to Front.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Executable.setCode failed when the compiler produced no code after a compile
error. This adopts that fix and the other general changes from the runtime
published to npm as @objj/runtime, without its Node-specific changes.
- CFDictionary.js: Add toJSObject, which returns the contents as a plain object
- Executable.js: Return early from setCode when no code was produced
- CPLog.js: Return early from CPLogPrint when CPLogDisable is set
- Bootstrap.js: Accept SourceMapIncludeSource in OBJJ_COMPILER_FLAGS
The source tree had no description of the frameworks package capp-build builds from its root.
* Info.plist: Declare the CPKG package with its runtime, member frameworks in build order, themes and version.
CPAlert's documentation described the return code as the button index, which is only its default tag.
* CPAlert: Document the alert return code as the clicked button's tag, which is its index unless changed.
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.
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.
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.