Commit Graph
86 Commits
Author SHA1 Message Date
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 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 7d59762561 AppKit: CPLayoutManager, CPStringDrawing, CPMenu, CPCookie PLATFORM conditional removal
- 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
2026-08-31 17:04:24 -06:00
David Richardson e5c34e3dd7 Remove NativeHost platform target; require CommonJS/Node for tooling
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
2026-08-12 13:25:52 -06:00
David Richardson 1a9a42ff54 Replace #pragma mark with // MARK:
Replace objc directive with native Javascript version // MARK: to facilitate elimination of preproccsing pass.
2026-07-21 15:15:53 -06:00
daboe01 0fed962b37 Fixed: CPLayoutManager false-positive layout rescue on zero-length-delta edits 2026-06-21 17:30:18 +02:00
daboe01 766035f4b7 Fixed: baseline alignment in _CPLineFragment to prevent overlapping text descenders 2026-06-20 12:06:24 +02:00
daboe01 de2ffd3aad New: implement baseline offsets and superscript/subscript support 2026-06-18 19:08:45 +02:00
daboe01 d75c0ac452 improved: tab management 2026-06-16 17:28:03 +02:00
daboe01 1cad83aba8 initial display of the table 2026-06-14 21:06:51 +02:00
daboe01 abe159eceb CPLayoutManager: Fix O(N^2) layout bottleneck when loading large text documents 2026-05-21 09:44:54 +02:00
daboe01 7f25de0fad improved: kerning safe optimization 2026-05-17 21:30:11 +02:00
daboe01 d6c5d8b4f2 formatting 2026-05-17 16:47:12 +02:00
daboe01 78e1ea43c8 new: layouting speedup in CPTextView 2026-05-17 15:58:16 +02:00
daboe01 9109cf3b54 Fixed: changing background color in CPTextView did not redraw properly (#3107) 2025-03-26 13:31:05 +01:00
Alfred Wärnsäter 2ecea40fdc lots of Node fixes 2021-08-19 10:56:13 +02:00
daboe01 77fe16faec Fixed: background color attribute was ignored by CPTextView (#2899) 2020-07-01 16:33:07 +02:00
daboe01 82e55b4761 Fixed: _glyphsFrames and _glyphsOffsets could be used uninitialized in CPTextView (#2886) 2020-03-03 17:04:52 +01:00
daboe01 d1bfe62a65 removed: obsolete fixme comment 2020-01-12 17:08:23 +01:00
daboe01 9e289574ff Fixed: attachment support was missing in CPTextView (#2872) 2019-12-19 09:08:33 +01:00
jasperdeb 58c08cebd7 Fixed: Added underline support in CPTextView (#2875) 2019-12-06 09:12:31 +01:00
daboe01 676c6e106d fixed: wrong return type of backgroundColorForGlyphAtIndex: 2018-10-14 13:34:33 +02:00
daniel de116c95d4 Formatting: add missing semi-colon to CPLayoutManager.j 2018-04-04 09:23:38 -07:00
daboe01 e0d42962e7 fixed: wrapping issue when dragging last word 2016-10-01 19:56:35 +02:00
daboe01 7dcec9afcf fixed: infinite loop due to undo edge case 2016-09-14 22:20:33 +02:00
daboe01 3a948406d5 optimisation: _indexOfObject used a method call instead of js property 2016-09-03 10:00:24 +02:00
daboe01 79311d107b fixed: line fragements were searched linearly instead of using binary search 2016-08-27 22:54:09 +02:00
daboe01 77435fcbd7 fixed: void scanning for fragments during typesetting 2016-08-27 14:25:44 +02:00
daboe01 b048ce9c8e formatting 2016-06-09 22:46:59 +02:00
daboe01 6a1040d659 fixed: setTextColor: issue second take 2016-06-09 22:35:50 +02:00
daboe01 fc05c28231 fixed: change in model did not propagate resize 2016-06-09 20:54:09 +02:00
daboe01 8d703b1459 fixed: updates to storage were not propageted to the view 2016-06-08 19:23:37 +02:00
daboe01 d4c77f9786 fixed: Setting textColor only changes first lines color 2016-06-07 20:54:11 +02:00
daboe01 021f8d0331 revert fixed: premature optimization 2016-06-05 22:23:26 +02:00
daboe01 e7d25550ee fixed: premature optimization 2016-06-05 22:21:01 +02:00
daboe01 8227276437 fixed: tabstops were accidentally cornercutting relayout 2016-06-05 21:20:50 +02:00
daboe01 7faa0f60b4 fixed: accidental duplication of variable definition 2016-05-28 13:40:30 +02:00
daboe01 faebbb2b8a fixed: font css properties were not considered when assessing visual identity 2016-05-27 23:13:54 +02:00
daboe01 bc9beb1e87 new: render to dom only the visible stuff 2016-05-27 21:24:30 +02:00
daboe01 43eb2932ba fixed: textColor only changes first lines color 2016-05-23 21:42:25 +02:00
Alexandre Wilhelm be129d243b Fixed: refactoring of CPTextView 2016-03-06 21:48:42 -08:00
daboe01 8f1a498953 added credits to andrew 2016-01-24 15:33:21 +01:00
daboe01 46f50f55c2 various baseline fixes 2015-07-03 20:03:53 +02:00
daboe01 5e880f6bfa Revert "_textContainer refac preparation"
This reverts commit 80cf88dcc1.
2015-07-03 17:26:20 +02:00
daboe01 80cf88dcc1 _textContainer refac preparation 2015-07-02 19:56:54 +02:00
daboe01 d22a7c0a63 FF copy paste fix 2015-07-01 22:52:01 +02:00
daboe01 59162155de caret loc refac 2015-07-01 07:20:17 +02:00
daboe01 587d8fbfa9 fix caret position 2015-06-29 20:19:47 +02:00
daboe01 e5ca98a1d3 fix baseline cross multiple fragments issue 2015-06-28 21:19:33 +02:00
daboe01 5bd5e9000e fix baseline issue with native input 2015-06-28 21:07:51 +02:00