Count a wrapped row without Math, which common/ cannot have
`terminal-draft-rows` reached for `Math/ceil`, and common/ is compiled twice: ClojureDart has no java.lang.Math, so the phone stopped building the moment the shared chat screen grew a compose bar that measures itself. The same edge `frq.clock` spells floor-div out for, and `frq.io` has utf8-bytes for. Ceiling division is integer arithmetic anyway — (n + cols - 1) quot cols — so this drops the float on the way as well, and nothing rounds a line the wrong way at the boundary. Same rows out: the headless terminal draws the one-row bar it drew before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2085edc parent: dd67233 modified
common/frq/screens/chat.cljc +5 -1 | @@ -65,7 +65,11 @@ | ||
| 65 | 65 | nowhere to go." |
| 66 | 66 | [] |
| 67 | 67 | (let [cols (max 20 (quot (- @cells/window-width (* 22 8)) 8)) |
| 68 | - wrapped (fn [line] (max 1 (long (Math/ceil (/ (count line) (double cols))))))] | |
| 68 | + ;; Ceiling division, written out: `Math/ceil` is Java and there is no | |
| 69 | + ;; Math under ClojureDart — the same reason `frq.clock` spells out | |
| 70 | + ;; floor-div. Integers throughout, so no float rounds a line the wrong | |
| 71 | + ;; way at the boundary either. | |
| 72 | + wrapped (fn [line] (max 1 (quot (+ (count line) cols -1) cols)))] | |
| 69 | 73 | (min draft-max-rows |
| 70 | 74 | (max 1 (reduce + (map wrapped (str/split-lines (or @cells/draft "")))))))) |
| 71 | 75 | |
| @@ -65,7 +65,11 @@ | |||
| 65 | nowhere to go." | 65 | nowhere to go." |
| 66 | [] | 66 | [] |
| 67 | (let [cols (max 20 (quot (- @cells/window-width (* 22 8)) 8)) | 67 | (let [cols (max 20 (quot (- @cells/window-width (* 22 8)) 8)) |
| 68 | - wrapped (fn [line] (max 1 (long (Math/ceil (/ (count line) (double cols))))))] | 68 | + ;; Ceiling division, written out: `Math/ceil` is Java and there is no |
| 69 | + ;; Math under ClojureDart — the same reason `frq.clock` spells out | ||
| 70 | + ;; floor-div. Integers throughout, so no float rounds a line the wrong | ||
| 71 | + ;; way at the boundary either. | ||
| 72 | + wrapped (fn [line] (max 1 (quot (+ (count line) cols -1) cols)))] | ||
| 69 | (min draft-max-rows | 73 | (min draft-max-rows |
| 70 | (max 1 (reduce + (map wrapped (str/split-lines (or @cells/draft "")))))))) | 74 | (max 1 (reduce + (map wrapped (str/split-lines (or @cells/draft "")))))))) |
| 71 | 75 | ||