Hyperscript: precedes/follows comparisons, tokenizer keywords
Parser: precedes/follows comparison operators in parse-cmp. Tokenizer: precedes, follows, ignoring, case keywords. Runtime: precedes?, follows? string comparison functions. 372/831 (45%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
sum-widths
|
||||
find-breaks
|
||||
break-lines
|
||||
break-lines-greedy
|
||||
position-line
|
||||
position-lines
|
||||
layout-paragraph
|
||||
@@ -309,4 +310,31 @@
|
||||
(lh (or line-height 1.4)))
|
||||
(layout-paragraph words f s w lh))))))
|
||||
|
||||
(define
|
||||
break-lines-greedy
|
||||
(fn
|
||||
(widths space-width max-width)
|
||||
(let
|
||||
((n (len widths)))
|
||||
(if
|
||||
(= n 0)
|
||||
(list)
|
||||
(let
|
||||
((lines (list)) (start 0) (used 0))
|
||||
(for-each
|
||||
(fn
|
||||
(i)
|
||||
(let
|
||||
((w (nth widths i))
|
||||
(needed (if (= i start) w (+ used space-width w))))
|
||||
(if
|
||||
(and (> needed max-width) (not (= i start)))
|
||||
(do
|
||||
(set! lines (append lines (list (list start i))))
|
||||
(set! start i)
|
||||
(set! used w))
|
||||
(set! used needed))))
|
||||
(range n))
|
||||
(append lines (list (list start n))))))))
|
||||
|
||||
(import (sx text-layout))
|
||||
Reference in New Issue
Block a user