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.
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.
- CPTextField, CPTokenField, CPTextView: the PLATFORM(DOM) gates
around _inputElement (superclass and override) and _cumulativeOffset
are removed; the methods now exist under both targets with runtime
CPDOMAvailable guards returning nil (object methods) or a zero
point (struct method) when no DOM is present
- contract change: under CommonJS these methods change from absent to
present-and-inert; all callers are browser event paths never
exercised by the theme blender or nib2cib
- zero preprocessor directives remain in these three files
- work-in-progress towards complete removal of CPP directives
Merges 71 commits from main. Headline content: the Tests/Manual
integration test suite revived and reorganized after long disuse
(renames, new applications, updated cibs), restoring a large
integration validation surface. Functional fixes include replacing
unload-based termination with pagehide (back/forward cache
compatibility) and hardening CPTextField's input-element handling.
Conflict resolutions (local versions retained):
- AppKit/CPTextField.j: main's input-element logic carried, with this
branch's preprocessor-removal sweep re-applied on top. Main's
conditionals are re-expressed as runtime CPDOMAvailable guards; the
_inputElement method-definition gate is retained.
- AppKit/Platform/CPPlatform.j: the DOM platform implementation stays
inlined under the PLATFORM(DOM) gate. The split layout breaks the
legacy build: the include fragment is compiled standalone by the
source walk and cannot resolve its superclass. Main's pagehide
termination fix is ported into the inlined section; the restored
AppKit/Platform/DOM/CPPlatform.j fragment is deleted.
Verified: legacy build green through Foundation, AppKit and Tools;
Tests/Manual suite passing.
- 8 PLATFORM blocks resolved across four files: runtime CPDOMAvailable
guards (3 wrapped, 2 early returns, 3 if/else preserving existing
CommonJS branches)
- CPMenu: @global _CPDOMEventStop declared; its definition resides in
the DOM-only CPPlatformWindow+DOM category
- zero preprocessor directives remain in these files
- work-in-progress towards complete removal of CPP directives
Declare _clientView within the CPRulerView instance variable block.
This resolves a cold build compilation failure where the Objective-J parser flags assignments to the undeclared variable as illegal global variable creations.
CPFontPanel.j used _CPFontPanelPreviewView as an ivar type and instantiated it before its own @implementation, later in the same file, with no forward declaration. Added @class _CPFontPanelPreviewView, alongside the file's existing forward declarations.
This removes all build warnings.
CPParagraphStyle.j defined CPTabStopType's four constants directly, with a comment noting they were "missing" but no @typedef for the type itself.
_CPRTFParser.j uses CPTabStopType as an ivar type and imports CPParagraphStyle.j directly, so the fix belongs in the defining file.
Added the missing @typedef CPTabStopType, same pattern as CPRulerOrientation.
CPRulerView.j declared CPRulerOrientation's constants directly,
with only a comment claiming it was a typedef.
No @typedef directive existed, so the type was unknown wherever used as an ivar or parameter type.
Added the missing @typedef CPRulerOrientation, matching the pattern already used for CPTextAlignment in CPText.j.
CPRulerView.j referenced CPTextTab (isKindOfClass: and alloc/init) without a declaration.
Added @class CPTextTab; to resolve the symbol reference. A forward declaration was utilized rather than importing CPParagraphStyle.j to minimize dependency coupling, despite the absence of a circular import risk.
Resolves build warning.
Replaced the CPTextView.j import with forward declarations for CPTextView and CPTextContainer (the latter previously reached via the removed import).
The previous import graph created a circular dependency (_CPTableTextAttachment.j -> CPTextView.j -> _CPRTFParser.j / _CPRTFProducer.j -> _CPTableTextAttachment.j).
This caused the legacy compiler to emit a class registration warning during clean builds, as the class was unregistered at the time of resolution. Incremental builds masked this warning via cached symbol tables.
Using forward declarations breaks the cycle and ensures warning-free clean and incremental builds.
CPRulerView.j did not import CPScrollView.
A direct import would create a cycle, since CPScrollView.j already imports CPRulerView.j.
Added a forward declaration instead.
Cappuccino previously supported three platform contexts behind the
PLATFORM() preprocessor macro: Browser, CommonJS/Node, and a NativeHost
target. NativeHost is no longer supported; this removes it and
consolidates on Browser (for the app) and CommonJS/Node (still needed
by the toolchain itself, for theme compilation and testing).
PLATFORM(DOM) conditionals throughout AppKit governed both distinctions
at once - Browser vs NativeHost, and separately, DOM-dependent code vs
the CommonJS/Node build. Each conditional was reviewed individually:
NativeHost-only branches were removed, while branches needed for
CommonJS/Node were kept intact rather than collapsed to Browser-only.
Also included, found in the course of this work:
- Fixed two pre-existing duplicate instance-variable declarations
(_ephemeralSubviews in CPView, _scrollingTimer in CPTextView)
- Added a missing @import for CPTextContainer.j in CPTextView.j so
it resolves when compiled outside the full framework bundle
- Merged two Platform/DOM/*.j files into their parents to resolve a
build-tool basename collision, preserving the CommonJS fallback path