Leave a gap between a line and the scrollbar
Reserving the bar alone puts the wrap boundary at its left edge, so a line ends flush against it: legible, but it reads as text running into the bar, and a glyph whose drawn width runs a hair past its measured one touches it. The strip is the bar and a gap now, which is what puts the last word beside the bar rather than on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
d6b9f3a parent: 5145c3b modified
jvui/src/jvui/widgets.clj +7 -1 | @@ -481,7 +481,13 @@ | ||
| 481 | 481 | ;; painted over the viewport's right edge: without it the last |
| 482 | 482 | ;; characters of every wrapped line sit under the bar, which is |
| 483 | 483 | ;; where "the sidebar truncates" comes from. |
| 484 | - gutter (double (c/th :scrollbar)) | |
| 484 | + ;; The bar's own width and a gap beside it. Reserving the bar alone | |
| 485 | + ;; leaves the wrap boundary exactly at its left edge, so a line ends | |
| 486 | + ;; flush against it — legible, but it reads as text running into the | |
| 487 | + ;; bar, and a glyph whose drawn width runs a hair past its measured | |
| 488 | + ;; one touches it. A gap is what puts the last word beside the bar | |
| 489 | + ;; rather than on it. | |
| 490 | + gutter (+ (double (c/th :scrollbar)) (double (c/th :spacing))) | |
| 485 | 491 | r (c/box* (merge {:dir :vertical |
| 486 | 492 | :expand :both |
| 487 | 493 | :pad-right gutter |
| @@ -481,7 +481,13 @@ | |||
| 481 | ;; painted over the viewport's right edge: without it the last | 481 | ;; painted over the viewport's right edge: without it the last |
| 482 | ;; characters of every wrapped line sit under the bar, which is | 482 | ;; characters of every wrapped line sit under the bar, which is |
| 483 | ;; where "the sidebar truncates" comes from. | 483 | ;; where "the sidebar truncates" comes from. |
| 484 | - gutter (double (c/th :scrollbar)) | 484 | + ;; The bar's own width and a gap beside it. Reserving the bar alone |
| 485 | + ;; leaves the wrap boundary exactly at its left edge, so a line ends | ||
| 486 | + ;; flush against it — legible, but it reads as text running into the | ||
| 487 | + ;; bar, and a glyph whose drawn width runs a hair past its measured | ||
| 488 | + ;; one touches it. A gap is what puts the last word beside the bar | ||
| 489 | + ;; rather than on it. | ||
| 490 | + gutter (+ (double (c/th :scrollbar)) (double (c/th :spacing))) | ||
| 485 | r (c/box* (merge {:dir :vertical | 491 | r (c/box* (merge {:dir :vertical |
| 486 | :expand :both | 492 | :expand :both |
| 487 | :pad-right gutter | 493 | :pad-right gutter |