@optique/core 1.4.0-dev.2722 → 1.4.0-dev.2723

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/doc.cjs CHANGED
@@ -555,8 +555,8 @@ function formatDocPage(programName, page, options = {}) {
555
555
  const appendAnnotation = (content, layout, style, ambient, quotes) => {
556
556
  let prefixText = layout.prefix;
557
557
  let prefix = require_text_layout.placeText(prefixText, cursor, descColumnWidth, 1);
558
- if (prefix.text !== layout.prefix) {
559
- description += "\n";
558
+ if (prefix.text !== layout.prefix || descColumnWidth != null && cursor.column === 0 && layout.prefixMetrics.firstLineWidth > descColumnWidth) {
559
+ if (cursor.column > 0) description += "\n";
560
560
  prefixText = require_text_layout.trimLeadingSpace(layout.prefix);
561
561
  prefix = require_text_layout.placeText(prefixText, {
562
562
  line: "",
package/dist/doc.js CHANGED
@@ -555,8 +555,8 @@ function formatDocPage(programName, page, options = {}) {
555
555
  const appendAnnotation = (content, layout, style, ambient, quotes) => {
556
556
  let prefixText = layout.prefix;
557
557
  let prefix = placeText(prefixText, cursor, descColumnWidth, 1);
558
- if (prefix.text !== layout.prefix) {
559
- description += "\n";
558
+ if (prefix.text !== layout.prefix || descColumnWidth != null && cursor.column === 0 && layout.prefixMetrics.firstLineWidth > descColumnWidth) {
559
+ if (cursor.column > 0) description += "\n";
560
560
  prefixText = trimLeadingSpace(layout.prefix);
561
561
  prefix = placeText(prefixText, {
562
562
  line: "",
@@ -67,8 +67,9 @@ function trimLeadingSpace(text) {
67
67
  * Measures an annotation's fixed text without invoking theme callbacks.
68
68
  * @param prefix The already joined prefix and optional label.
69
69
  * @param suffix The closing text.
70
- * @returns Geometry reserving at least one content column after the suffix's
71
- * first-line width has been deducted from the formatter budget.
70
+ * @returns Geometry for a heading placed on a fresh line without its leading
71
+ * separator whitespace, reserving at least one content column after the
72
+ * suffix's first-line width has been deducted from the formatter budget.
72
73
  * @internal
73
74
  */
74
75
  function measureAnnotation(prefix, suffix) {
@@ -79,7 +80,7 @@ function measureAnnotation(prefix, suffix) {
79
80
  suffix,
80
81
  prefixMetrics,
81
82
  suffixMetrics,
82
- minWidth: Math.max(prefixMetrics.maxLineWidth, suffixMetrics.maxLineWidth, suffixMetrics.firstLineWidth + 1)
83
+ minWidth: Math.max(measureText(trimLeadingSpace(prefix)).maxLineWidth, suffixMetrics.maxLineWidth, suffixMetrics.firstLineWidth + 1)
83
84
  };
84
85
  }
85
86
  /**
@@ -67,8 +67,9 @@ function trimLeadingSpace(text) {
67
67
  * Measures an annotation's fixed text without invoking theme callbacks.
68
68
  * @param prefix The already joined prefix and optional label.
69
69
  * @param suffix The closing text.
70
- * @returns Geometry reserving at least one content column after the suffix's
71
- * first-line width has been deducted from the formatter budget.
70
+ * @returns Geometry for a heading placed on a fresh line without its leading
71
+ * separator whitespace, reserving at least one content column after the
72
+ * suffix's first-line width has been deducted from the formatter budget.
72
73
  * @internal
73
74
  */
74
75
  function measureAnnotation(prefix, suffix) {
@@ -79,7 +80,7 @@ function measureAnnotation(prefix, suffix) {
79
80
  suffix,
80
81
  prefixMetrics,
81
82
  suffixMetrics,
82
- minWidth: Math.max(prefixMetrics.maxLineWidth, suffixMetrics.maxLineWidth, suffixMetrics.firstLineWidth + 1)
83
+ minWidth: Math.max(measureText(trimLeadingSpace(prefix)).maxLineWidth, suffixMetrics.maxLineWidth, suffixMetrics.firstLineWidth + 1)
83
84
  };
84
85
  }
85
86
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.4.0-dev.2722",
3
+ "version": "1.4.0-dev.2723",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -245,7 +245,7 @@
245
245
  },
246
246
  "sideEffects": false,
247
247
  "devDependencies": {
248
- "@optique/env": "1.4.0-dev.2722+883bcdfe",
248
+ "@optique/env": "1.4.0-dev.2723+56e838af",
249
249
  "@types/node": "^24.0.0",
250
250
  "fast-check": "^4.7.0",
251
251
  "tsdown": "^0.13.0",