ccstatusline-zh 2.2.33 → 2.2.35

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.
@@ -2,7 +2,6 @@ import {
2
2
  source_default,
3
3
  stripAnsi,
4
4
  GRADIENT_PRESET_NAMES,
5
- stripOscCodes,
6
5
  getVisibleWidth,
7
6
  truncateStyledText,
8
7
  COLOR_MAP,
@@ -15,9 +14,6 @@ import {
15
14
  getPowerlineThemes,
16
15
  getPowerlineTheme,
17
16
  getDefaultPowerlineTheme,
18
- getColorLevelString,
19
- NUMBER_KINDS,
20
- DefaultPaddingSideSchema,
21
17
  generateGuid,
22
18
  getPackageVersion,
23
19
  canDetectTerminalWidth,
@@ -34,6 +30,7 @@ import {
34
30
  setEnabledHideStates,
35
31
  getHideKeybind,
36
32
  getHideModifierText,
33
+ sanitizeTerminalText,
37
34
  require_react,
38
35
  Box_default,
39
36
  Text,
@@ -41,9 +38,11 @@ import {
41
38
  Transform,
42
39
  use_input_default,
43
40
  use_app_default,
41
+ use_stdout_default,
44
42
  getPlainInput,
45
43
  shouldInsertInput,
46
44
  require_jsx_runtime,
45
+ BlinkingCursor,
47
46
  useTextCursor,
48
47
  CYCLE_NUMBER_STYLE_ACTION,
49
48
  NUMBER_STYLE_LABELS,
@@ -82,12 +81,27 @@ import {
82
81
  validateImportFile,
83
82
  applyImport,
84
83
  saveInstallationMetadata
85
- } from "./ccstatusline-3tcnryv5.js";
84
+ } from "./ccstatusline-98magj3t.js";
85
+ import {
86
+ getColorLevelString,
87
+ NUMBER_KINDS,
88
+ DefaultPaddingSideSchema,
89
+ DEFAULT_SETTINGS
90
+ } from "./ccstatusline-88bs860s.js";
91
+ import {
92
+ DEV_RELOAD_EXIT_CODE2,
93
+ getDevReloadStateFile2,
94
+ writeDevReloadSnapshot2,
95
+ discardDevReloadSnapshot2,
96
+ readDevReloadSnapshot2,
97
+ requestDevReload2,
98
+ isDevReloadRequested2
99
+ } from "./ccstatusline-j1gdxtq4.js";
86
100
  import {
87
101
  assignPowerlineThemeSlots,
88
102
  advanceGlobalPowerlineThemeIndex,
89
103
  advanceGlobalSeparatorIndex
90
- } from "./ccstatusline-rdsx5ab1.js";
104
+ } from "./ccstatusline-71188a0p.js";
91
105
  import {
92
106
  __toESM,
93
107
  __commonJS
@@ -2091,12 +2105,16 @@ function splitCommandOutput(output) {
2091
2105
  }
2092
2106
  return paths;
2093
2107
  }
2094
- function isTransientBunxStatusLinePath(filePath) {
2108
+ var TRANSIENT_STATUS_LINE_PATH_PATTERNS = [
2109
+ /(?:^|\/)bunx-[^/]*ccstatusline-zh@[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i,
2110
+ /(?:^|\/)_npx\/[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i
2111
+ ];
2112
+ function isTransientStatusLinePath(filePath) {
2095
2113
  const normalized = filePath.replace(/\\/g, "/");
2096
- return /(?:^|\/)bunx-[^/]*ccstatusline-zh@[^/]+\/node_modules\/\.bin\/ccstatusline-zh(?:\.(?:cmd|ps1))?$/i.test(normalized);
2114
+ return TRANSIENT_STATUS_LINE_PATH_PATTERNS.some((pattern) => pattern.test(normalized));
2097
2115
  }
2098
2116
  function getPersistentCommandResolutionPaths(paths) {
2099
- return paths.filter((path) => !isTransientBunxStatusLinePath(path));
2117
+ return paths.filter((path) => !isTransientStatusLinePath(path));
2100
2118
  }
2101
2119
  function getCommandResolutionPaths(command, { platform = process.platform } = {}) {
2102
2120
  try {
@@ -2294,7 +2312,8 @@ function getDirectoryName2(filePath) {
2294
2312
  return lastSlashIndex === -1 ? "" : normalized.slice(0, lastSlashIndex);
2295
2313
  }
2296
2314
  function getComparablePath(filePath) {
2297
- return filePath.replace(/\\/g, "/").toLowerCase().replace(/\/+$/, "");
2315
+ const normalized = filePath.replace(/\\/g, "/").replace(/\/+$/, "");
2316
+ return isWindowsStylePath(normalized) || normalized.startsWith("/mnt/") ? normalized.toLowerCase() : normalized;
2298
2317
  }
2299
2318
  function getUniqueResolvedDirs2(resolvedPaths) {
2300
2319
  const seen = new Set;
@@ -4406,7 +4425,7 @@ function ExportConfigDialog({ onExport, onCancel }) {
4406
4425
  /* @__PURE__ */ jsx_runtime4.jsx(Text, {
4407
4426
  children: inputValue
4408
4427
  }),
4409
- /* @__PURE__ */ jsx_runtime4.jsx(Text, {
4428
+ /* @__PURE__ */ jsx_runtime4.jsx(BlinkingCursor, {
4410
4429
  inverse: true,
4411
4430
  children: " "
4412
4431
  })
@@ -4458,7 +4477,7 @@ function ImportConfigDialog({ onFileChosen, onCancel }) {
4458
4477
  /* @__PURE__ */ jsx_runtime5.jsx(Text, {
4459
4478
  children: inputValue
4460
4479
  }),
4461
- /* @__PURE__ */ jsx_runtime5.jsx(Text, {
4480
+ /* @__PURE__ */ jsx_runtime5.jsx(BlinkingCursor, {
4462
4481
  inverse: true,
4463
4482
  children: " "
4464
4483
  })
@@ -5738,7 +5757,7 @@ var import_react12 = __toESM(require_react(), 1);
5738
5757
 
5739
5758
  // src/tui/components/LabelEditor.tsx
5740
5759
  var jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
5741
- var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel }) => {
5760
+ var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel, onPreview }) => {
5742
5761
  const { getText, display, handleInput } = useTextCursor(getLabel(widget, defaultLabel));
5743
5762
  use_input_default((input, key) => {
5744
5763
  if (key.return) {
@@ -5748,7 +5767,11 @@ var LabelEditor = ({ widget, defaultLabel, onComplete, onCancel }) => {
5748
5767
  } else if (key.tab) {
5749
5768
  onComplete(clearLabel(widget));
5750
5769
  } else {
5770
+ const previousText = getText();
5751
5771
  handleInput(input, key);
5772
+ if (getText() !== previousText) {
5773
+ onPreview?.(setLabel(widget, getText()));
5774
+ }
5752
5775
  }
5753
5776
  });
5754
5777
  return /* @__PURE__ */ jsx_runtime10.jsxs(Box_default, {
@@ -6135,6 +6158,73 @@ function handleNormalInputMode({
6135
6158
  }
6136
6159
  }
6137
6160
 
6161
+ // src/tui/components/items-editor/list-window.ts
6162
+ var PICKER_RESERVED_ROWS = 16;
6163
+ var MIN_VISIBLE_ENTRIES = 3;
6164
+ var DEFAULT_VISIBLE_ENTRIES = 10;
6165
+ function getListWindow(total, selectedIndex, maxVisible) {
6166
+ if (total <= maxVisible) {
6167
+ return { start: 0, end: total, hiddenAbove: 0, hiddenBelow: 0 };
6168
+ }
6169
+ const start = Math.min(Math.max(0, selectedIndex - Math.floor(maxVisible / 2)), total - maxVisible);
6170
+ const end = start + maxVisible;
6171
+ return { start, end, hiddenAbove: start, hiddenBelow: total - end };
6172
+ }
6173
+ function getPickerMaxVisible(terminalRows, statusLineCount, descriptionRows = 1) {
6174
+ if (!terminalRows) {
6175
+ return DEFAULT_VISIBLE_ENTRIES;
6176
+ }
6177
+ return Math.max(MIN_VISIBLE_ENTRIES, terminalRows - PICKER_RESERVED_ROWS - statusLineCount - (descriptionRows - 1));
6178
+ }
6179
+ function getWrappedRows(line, width) {
6180
+ let rows = 1;
6181
+ let used = 0;
6182
+ for (const word of line.split(" ")) {
6183
+ const wordWidth = getVisibleWidth(word);
6184
+ if (used > 0 && used + 1 + wordWidth <= width) {
6185
+ used += 1 + wordWidth;
6186
+ continue;
6187
+ }
6188
+ if (used > 0) {
6189
+ rows++;
6190
+ }
6191
+ rows += Math.floor(Math.max(0, wordWidth - 1) / width);
6192
+ used = wordWidth === 0 ? 0 : (wordWidth - 1) % width + 1;
6193
+ }
6194
+ return rows;
6195
+ }
6196
+ function getDescriptionRows(description, width) {
6197
+ const lines = description.split(`
6198
+ `);
6199
+ if (!width || width < 1) {
6200
+ return lines.length;
6201
+ }
6202
+ return lines.reduce((rows, line) => rows + getWrappedRows(line, width), 0);
6203
+ }
6204
+
6205
+ // src/tui/components/items-editor/picker-selection.ts
6206
+ function getPickerInsertIndex(action, widgetCount, selectedIndex) {
6207
+ if (action === "add") {
6208
+ return widgetCount > 0 ? selectedIndex + 1 : 0;
6209
+ }
6210
+ return selectedIndex;
6211
+ }
6212
+ function placePickerSelection(widgets, action, selectedIndex, selectedType, newWidget) {
6213
+ if (action === "change") {
6214
+ const currentWidget = widgets[selectedIndex];
6215
+ if (!currentWidget) {
6216
+ return { widgets, selectedIndex };
6217
+ }
6218
+ const newWidgets = [...widgets];
6219
+ newWidgets[selectedIndex] = currentWidget.type === selectedType ? currentWidget : { ...clearLabel(currentWidget), type: selectedType };
6220
+ return { widgets: newWidgets, selectedIndex };
6221
+ }
6222
+ const insertIndex = getPickerInsertIndex(action, widgets.length, selectedIndex);
6223
+ const newWidgets = [...widgets];
6224
+ newWidgets.splice(insertIndex, 0, { ...newWidget, type: selectedType });
6225
+ return { widgets: newWidgets, selectedIndex: insertIndex };
6226
+ }
6227
+
6138
6228
  // src/tui/components/ItemsEditor.tsx
6139
6229
  var jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
6140
6230
  function isMergedIntoPreviousWidget(widgets, index) {
@@ -6143,13 +6233,52 @@ function isMergedIntoPreviousWidget(widgets, index) {
6143
6233
  }
6144
6234
  return Boolean(widgets[index - 1]?.merge);
6145
6235
  }
6146
- var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6147
- const [selectedIndex, setSelectedIndex] = import_react12.useState(0);
6236
+ var DESCRIPTION_INDENT = 2;
6237
+ var HiddenEntriesMarker = ({ arrow, count }) => /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
6238
+ paddingLeft: 3,
6239
+ children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
6240
+ dimColor: true,
6241
+ children: count > 0 ? `${arrow} 另有 ${count} 项` : " "
6242
+ })
6243
+ });
6244
+ function renderWindowedList(items, selectedIndex, maxVisible, renderItem) {
6245
+ const visible = getListWindow(items.length, Math.max(0, selectedIndex), maxVisible);
6246
+ const isWindowed = items.length > maxVisible;
6247
+ return /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
6248
+ children: [
6249
+ isWindowed && /* @__PURE__ */ jsx_runtime11.jsx(HiddenEntriesMarker, {
6250
+ arrow: "↑",
6251
+ count: visible.hiddenAbove
6252
+ }),
6253
+ items.slice(visible.start, visible.end).map((item, offset) => renderItem(item, visible.start + offset)),
6254
+ isWindowed && /* @__PURE__ */ jsx_runtime11.jsx(HiddenEntriesMarker, {
6255
+ arrow: "↓",
6256
+ count: visible.hiddenBelow
6257
+ })
6258
+ ]
6259
+ });
6260
+ }
6261
+ var ItemsEditor = ({
6262
+ widgets,
6263
+ onUpdate,
6264
+ onPreviewChange,
6265
+ onBack,
6266
+ initialSelectedIndex = 0,
6267
+ onSelectedIndexChange,
6268
+ lineNumber,
6269
+ settings
6270
+ }) => {
6271
+ const [selectedIndex, setSelectedIndex] = import_react12.useState(() => Math.min(initialSelectedIndex, Math.max(0, widgets.length - 1)));
6148
6272
  const [moveMode, setMoveMode] = import_react12.useState(false);
6149
6273
  const [customEditorWidget, setCustomEditorWidget] = import_react12.useState(null);
6150
6274
  const [widgetPicker, setWidgetPicker] = import_react12.useState(null);
6275
+ const [pickerNewWidget, setPickerNewWidget] = import_react12.useState(null);
6151
6276
  const [showClearConfirm, setShowClearConfirm] = import_react12.useState(false);
6277
+ const { stdout } = use_stdout_default();
6152
6278
  const separatorChars = ["|", "-", ",", " "];
6279
+ import_react12.useEffect(() => () => {
6280
+ onPreviewChange?.(null);
6281
+ }, [onPreviewChange]);
6153
6282
  const widgetCatalog = getWidgetCatalog(settings);
6154
6283
  const widgetCategories = ["全部", ...getWidgetCatalogCategories(widgetCatalog)];
6155
6284
  const getUniqueBackgroundColor = (insertIndex) => {
@@ -6172,9 +6301,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6172
6301
  const newWidgets = [...widgets];
6173
6302
  newWidgets[selectedIndex] = updatedWidget;
6174
6303
  onUpdate(newWidgets);
6304
+ onPreviewChange?.(null);
6175
6305
  setCustomEditorWidget(null);
6176
6306
  };
6177
6307
  const handleEditorCancel = () => {
6308
+ onPreviewChange?.(null);
6178
6309
  setCustomEditorWidget(null);
6179
6310
  };
6180
6311
  const getCustomKeybindsForWidget = (widgetImpl, widget) => {
@@ -6185,7 +6316,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6185
6316
  if ((widgetImpl.getHideableStates?.().length ?? 0) > 0) {
6186
6317
  keybinds.push(getHideKeybind());
6187
6318
  }
6188
- if (widgetImpl.getLabelPrefix && !widget.rawValue) {
6319
+ if (!widget.rawValue && widgetImpl.getLabelPrefix?.(widget) !== undefined) {
6189
6320
  keybinds.push(getLabelKeybind());
6190
6321
  }
6191
6322
  return keybinds;
@@ -6196,6 +6327,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6196
6327
  }
6197
6328
  const currentType = widgets[selectedIndex]?.type;
6198
6329
  const selectedType = action === "change" ? currentType ?? null : null;
6330
+ const backgroundColor = action === "change" ? undefined : getUniqueBackgroundColor(getPickerInsertIndex(action, widgets.length, selectedIndex));
6331
+ setPickerNewWidget({
6332
+ id: generateGuid(),
6333
+ ...backgroundColor && { backgroundColor }
6334
+ });
6199
6335
  setWidgetPicker(normalizePickerState({
6200
6336
  action,
6201
6337
  level: "category",
@@ -6209,25 +6345,10 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6209
6345
  if (!widgetPicker) {
6210
6346
  return;
6211
6347
  }
6212
- if (widgetPicker.action === "change") {
6213
- const currentWidget = widgets[selectedIndex];
6214
- if (currentWidget) {
6215
- const newWidgets = [...widgets];
6216
- newWidgets[selectedIndex] = currentWidget.type === selectedType ? currentWidget : { ...clearLabel(currentWidget), type: selectedType };
6217
- onUpdate(newWidgets);
6218
- }
6219
- } else {
6220
- const insertIndex = widgetPicker.action === "add" ? widgets.length > 0 ? selectedIndex + 1 : 0 : selectedIndex;
6221
- const backgroundColor = getUniqueBackgroundColor(insertIndex);
6222
- const newWidget = {
6223
- id: generateGuid(),
6224
- type: selectedType,
6225
- ...backgroundColor && { backgroundColor }
6226
- };
6227
- const newWidgets = [...widgets];
6228
- newWidgets.splice(insertIndex, 0, newWidget);
6229
- onUpdate(newWidgets);
6230
- setSelectedIndex(insertIndex);
6348
+ const placement = placePickerSelection(widgets, widgetPicker.action, selectedIndex, selectedType, pickerNewWidget ?? { id: generateGuid() });
6349
+ if (placement.widgets !== widgets) {
6350
+ onUpdate(placement.widgets);
6351
+ setSelectedIndex(placement.selectedIndex);
6231
6352
  }
6232
6353
  setWidgetPicker(null);
6233
6354
  };
@@ -6320,6 +6441,24 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6320
6441
  const selectedTopLevelSearchEntry = widgetPicker ? topLevelSearchEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? topLevelSearchEntries[0] : null;
6321
6442
  const pickerEntries = widgetPicker ? filterWidgetCatalog(widgetCatalog, selectedPickerCategory ?? "全部", widgetPicker.widgetQuery) : [];
6322
6443
  const selectedPickerEntry = widgetPicker ? pickerEntries.find((entry) => entry.type === widgetPicker.selectedType) ?? pickerEntries[0] : null;
6444
+ const browsedEntries = widgetPicker?.level === "widget" ? pickerEntries : topLevelSearchEntries;
6445
+ const descriptionWidth = stdout.columns ? stdout.columns - DESCRIPTION_INDENT : undefined;
6446
+ const pickerMaxVisible = getPickerMaxVisible(stdout.rows, settings.lines.filter((line) => line.length > 0).length, Math.max(1, ...browsedEntries.map((entry) => getDescriptionRows(entry.description, descriptionWidth))));
6447
+ const searchResultType = widgetPicker && widgetPicker.categoryQuery.trim().length > 0 ? selectedTopLevelSearchEntry?.type : undefined;
6448
+ const highlightedPickerType = widgetPicker?.level === "widget" ? selectedPickerEntry?.type : searchResultType;
6449
+ const pickerAction = widgetPicker?.action;
6450
+ const previewWidgets = import_react12.useMemo(() => {
6451
+ if (!pickerAction || !highlightedPickerType || !pickerNewWidget) {
6452
+ return null;
6453
+ }
6454
+ return placePickerSelection(widgets, pickerAction, selectedIndex, highlightedPickerType, pickerNewWidget).widgets;
6455
+ }, [widgets, pickerAction, selectedIndex, highlightedPickerType, pickerNewWidget]);
6456
+ import_react12.useEffect(() => {
6457
+ onPreviewChange?.(previewWidgets);
6458
+ }, [onPreviewChange, previewWidgets]);
6459
+ import_react12.useEffect(() => {
6460
+ onSelectedIndexChange?.(selectedIndex);
6461
+ }, [onSelectedIndexChange, selectedIndex]);
6323
6462
  let helpText = hasWidgets ? "↑↓ 选择, ←→ 打开类型选择器" : "(a)添加, (i)插入";
6324
6463
  if (isSeparator) {
6325
6464
  helpText += ", 空格编辑分隔符";
@@ -6347,12 +6486,18 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6347
6486
  onCancel: handleEditorCancel
6348
6487
  });
6349
6488
  }
6350
- if (customEditorWidget?.action === EDIT_LABEL_ACTION && customEditorWidget.impl.getLabelPrefix) {
6489
+ const editorLabel = customEditorWidget?.impl.getLabelPrefix?.(customEditorWidget.widget);
6490
+ if (customEditorWidget?.action === EDIT_LABEL_ACTION && editorLabel !== undefined) {
6351
6491
  return /* @__PURE__ */ jsx_runtime11.jsx(LabelEditor, {
6352
6492
  widget: customEditorWidget.widget,
6353
- defaultLabel: customEditorWidget.impl.getLabelPrefix(customEditorWidget.widget),
6493
+ defaultLabel: editorLabel,
6354
6494
  onComplete: handleEditorComplete,
6355
- onCancel: handleEditorCancel
6495
+ onCancel: handleEditorCancel,
6496
+ onPreview: (updatedWidget) => {
6497
+ const previewWidgets = [...widgets];
6498
+ previewWidgets[selectedIndex] = updatedWidget;
6499
+ onPreviewChange?.(previewWidgets);
6500
+ }
6356
6501
  });
6357
6502
  }
6358
6503
  if (customEditorWidget?.impl.renderEditor) {
@@ -6541,7 +6686,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6541
6686
  children: "没有匹配的组件。"
6542
6687
  }) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
6543
6688
  children: [
6544
- topLevelSearchEntries.map((entry, index) => {
6689
+ renderWindowedList(topLevelSearchEntries, topLevelSearchEntries.findIndex((entry) => entry.type === selectedTopLevelSearchEntry?.type), pickerMaxVisible, (entry, index) => {
6545
6690
  const isSelected = entry.type === selectedTopLevelSearchEntry?.type;
6546
6691
  const segments = getMatchSegments(entry.displayName, widgetPicker.categoryQuery);
6547
6692
  return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
@@ -6569,7 +6714,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6569
6714
  }),
6570
6715
  selectedTopLevelSearchEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
6571
6716
  marginTop: 1,
6572
- paddingLeft: 2,
6717
+ paddingLeft: DESCRIPTION_INDENT,
6573
6718
  children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
6574
6719
  dimColor: true,
6575
6720
  children: selectedTopLevelSearchEntry.description
@@ -6581,7 +6726,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6581
6726
  children: "没有可用的分类。"
6582
6727
  }) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
6583
6728
  children: [
6584
- pickerCategories.map((category, index) => {
6729
+ renderWindowedList(pickerCategories, selectedPickerCategory === null ? -1 : pickerCategories.indexOf(selectedPickerCategory), pickerMaxVisible, (category, index) => {
6585
6730
  const isSelected = category === selectedPickerCategory;
6586
6731
  return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
6587
6732
  flexDirection: "row",
@@ -6615,7 +6760,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6615
6760
  children: "没有匹配当前分类/搜索的组件。"
6616
6761
  }) : /* @__PURE__ */ jsx_runtime11.jsxs(jsx_runtime11.Fragment, {
6617
6762
  children: [
6618
- pickerEntries.map((entry, index) => {
6763
+ renderWindowedList(pickerEntries, pickerEntries.findIndex((entry) => entry.type === selectedPickerEntry?.type), pickerMaxVisible, (entry, index) => {
6619
6764
  const isSelected = entry.type === selectedPickerEntry?.type;
6620
6765
  const segments = getMatchSegments(entry.displayName, widgetPicker.widgetQuery);
6621
6766
  return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
@@ -6643,7 +6788,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6643
6788
  }),
6644
6789
  selectedPickerEntry && /* @__PURE__ */ jsx_runtime11.jsx(Box_default, {
6645
6790
  marginTop: 1,
6646
- paddingLeft: 2,
6791
+ paddingLeft: DESCRIPTION_INDENT,
6647
6792
  children: /* @__PURE__ */ jsx_runtime11.jsx(Text, {
6648
6793
  dimColor: true,
6649
6794
  children: selectedPickerEntry.description
@@ -6667,7 +6812,7 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
6667
6812
  const supportsRawValue = widgetImpl?.supportsRawValue() ?? false;
6668
6813
  const numberFormatModifierText = widgetImpl?.supportsNumberFormat?.() ? getNumberFormatModifierText(widget) : undefined;
6669
6814
  const hideModifierText = widgetImpl ? getHideModifierText(widget, widgetImpl.getHideableStates?.() ?? []) : undefined;
6670
- const labelModifierText = widgetImpl?.getLabelPrefix && !widget.rawValue ? getLabelModifierText(widget) : undefined;
6815
+ const labelModifierText = !widget.rawValue && widgetImpl?.getLabelPrefix?.(widget) !== undefined ? getLabelModifierText(widget) : undefined;
6671
6816
  return /* @__PURE__ */ jsx_runtime11.jsxs(Box_default, {
6672
6817
  flexDirection: "row",
6673
6818
  flexWrap: "nowrap",
@@ -6762,6 +6907,7 @@ var LineSelector = ({
6762
6907
  onBack,
6763
6908
  onLinesUpdate,
6764
6909
  initialSelection = 0,
6910
+ onSelectionChange,
6765
6911
  title,
6766
6912
  blockIfPowerlineActive = false,
6767
6913
  settings,
@@ -6777,6 +6923,9 @@ var LineSelector = ({
6777
6923
  import_react13.useEffect(() => {
6778
6924
  setSelectedIndex(initialSelection);
6779
6925
  }, [initialSelection]);
6926
+ import_react13.useEffect(() => {
6927
+ onSelectionChange?.(selectedIndex);
6928
+ }, [onSelectionChange, selectedIndex]);
6780
6929
  const selectedLine = import_react13.useMemo(() => localLines[selectedIndex], [localLines, selectedIndex]);
6781
6930
  const appendLine = () => {
6782
6931
  const newLines = [...localLines, []];
@@ -7157,6 +7306,7 @@ var MainMenu = ({
7157
7306
  isClaudeInstalled,
7158
7307
  hasChanges,
7159
7308
  initialSelection = 0,
7309
+ onSelectionChange,
7160
7310
  powerlineFontStatus,
7161
7311
  settings,
7162
7312
  installation,
@@ -7187,7 +7337,8 @@ var MainMenu = ({
7187
7337
  }
7188
7338
  onSelect(value, index);
7189
7339
  },
7190
- initialSelection
7340
+ initialSelection,
7341
+ onSelectionChange: (_, index) => onSelectionChange?.(index)
7191
7342
  })
7192
7343
  ]
7193
7344
  });
@@ -7377,9 +7528,8 @@ function resolveEnabledPowerlineTheme(theme) {
7377
7528
  }
7378
7529
  return theme;
7379
7530
  }
7380
- function buildEnabledPowerlineSettings(settings, removeManualSeparators) {
7531
+ function buildEnabledPowerlineSettings(settings) {
7381
7532
  const powerlineConfig = settings.powerline;
7382
- const lines = removeManualSeparators ? settings.lines.map((line) => line.filter((item) => item.type !== "separator")) : settings.lines;
7383
7533
  return {
7384
7534
  ...settings,
7385
7535
  powerline: {
@@ -7389,8 +7539,7 @@ function buildEnabledPowerlineSettings(settings, removeManualSeparators) {
7389
7539
  separators: powerlineConfig.separators,
7390
7540
  separatorInvertBackground: powerlineConfig.separatorInvertBackground
7391
7541
  },
7392
- defaultPadding: " ",
7393
- lines
7542
+ defaultPadding: " "
7394
7543
  };
7395
7544
  }
7396
7545
 
@@ -7636,9 +7785,7 @@ var PowerlineSeparatorEditor = ({
7636
7785
  children: [
7637
7786
  "U+",
7638
7787
  hexInput.slice(0, cursorPos),
7639
- /* @__PURE__ */ jsx_runtime15.jsx(Text, {
7640
- backgroundColor: "gray",
7641
- color: "black",
7788
+ /* @__PURE__ */ jsx_runtime15.jsx(BlinkingCursor, {
7642
7789
  children: hexInput[cursorPos] ?? "_"
7643
7790
  }),
7644
7791
  hexInput.slice(cursorPos + 1),
@@ -8028,7 +8175,7 @@ var PowerlineSetup = ({
8028
8175
  if (hasManualSeparatorItems) {
8029
8176
  setConfirmingEnable(true);
8030
8177
  } else {
8031
- onUpdate(buildEnabledPowerlineSettings(settings, false));
8178
+ onUpdate(buildEnabledPowerlineSettings(settings));
8032
8179
  }
8033
8180
  } else {
8034
8181
  onUpdate({
@@ -8265,14 +8412,14 @@ var PowerlineSetup = ({
8265
8412
  /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
8266
8413
  children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
8267
8414
  color: "yellow",
8268
- children: "⚠ 警告:启用 Powerline 模式将移除状态栏中所有现有的分隔符和弹性分隔符。"
8415
+ children: "⚠ Powerline 模式使用自己的分隔符系统。"
8269
8416
  })
8270
8417
  }),
8271
8418
  /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
8272
8419
  marginBottom: 1,
8273
8420
  children: /* @__PURE__ */ jsx_runtime17.jsx(Text, {
8274
8421
  dimColor: true,
8275
- children: "Powerline 模式使用自己的分隔符系统,与手动分隔符不兼容。"
8422
+ children: "现有手动分隔符会保留在配置中,但在启用 Powerline 时不显示。"
8276
8423
  })
8277
8424
  })
8278
8425
  ]
@@ -8288,7 +8435,7 @@ var PowerlineSetup = ({
8288
8435
  children: /* @__PURE__ */ jsx_runtime17.jsx(ConfirmDialog, {
8289
8436
  inline: true,
8290
8437
  onConfirm: () => {
8291
- onUpdate(buildEnabledPowerlineSettings(settings, true));
8438
+ onUpdate(buildEnabledPowerlineSettings(settings));
8292
8439
  setConfirmingEnable(false);
8293
8440
  },
8294
8441
  onCancel: () => {
@@ -8747,7 +8894,7 @@ var renderSingleLine = (widgets, terminalWidth, settings, lineIndex, globalSepar
8747
8894
  };
8748
8895
  var PREVIEW_LINE_INDENT = " ";
8749
8896
  function preparePreviewLineForTerminal(line, terminalWidth) {
8750
- const printableLine = stripOscCodes(line);
8897
+ const printableLine = sanitizeTerminalText(line).replace(/\x1b\\/g, "\x07");
8751
8898
  const availableWidth = Math.max(0, terminalWidth - getVisibleWidth(PREVIEW_LINE_INDENT));
8752
8899
  return truncateStyledText(printableLine, availableWidth, { ellipsis: true });
8753
8900
  }
@@ -9038,19 +9185,25 @@ function validateCompactThresholdInput(value) {
9038
9185
  return null;
9039
9186
  }
9040
9187
  function buildTerminalWidthItems(selectedOption, compactThreshold) {
9188
+ const getSublabel = (option) => {
9189
+ if (option === selectedOption) {
9190
+ return "(当前)";
9191
+ }
9192
+ return option === DEFAULT_SETTINGS.flexMode ? "(默认)" : undefined;
9193
+ };
9041
9194
  return [
9042
9195
  {
9043
9196
  value: "full",
9044
9197
  label: "始终全宽",
9045
- sublabel: selectedOption === "full" ? "(当前)" : undefined,
9046
- description: `使用完整终端宽度减去 4 个字符的终端内边距。如果出现自动压缩消息,可能导致行换行。
9198
+ sublabel: getSublabel("full"),
9199
+ description: `使用完整终端宽度减去 6 个字符的终端内边距。如果出现自动压缩消息,可能导致行换行。
9047
9200
 
9048
9201
  注意:如果启用了 /ide 集成,不建议使用此模式。`
9049
9202
  },
9050
9203
  {
9051
9204
  value: "full-minus-40",
9052
9205
  label: "全宽减 40",
9053
- sublabel: selectedOption === "full-minus-40" ? "(当前)" : "(默认)",
9206
+ sublabel: getSublabel("full-minus-40"),
9054
9207
  description: "在状态栏右侧留出空间以容纳自动压缩消息。这可以防止换行但可能留下未使用的空间。此限制存在是因为我们无法检测消息何时出现。"
9055
9208
  },
9056
9209
  {
@@ -9436,17 +9589,17 @@ function getPinnedMismatchItems(mismatch, canRunPackageManager) {
9436
9589
  const items = [];
9437
9590
  if (mismatch.canUpdateToRunningVersion) {
9438
9591
  items.push({
9439
- label: `Update ${mismatch.packageManager} global install to v${mismatch.runningVersion}`,
9592
+ label: `更新 ${mismatch.packageManager} 全局安装至 v${mismatch.runningVersion}`,
9440
9593
  value: "update",
9441
9594
  disabled: !canRunPackageManager,
9442
- sublabel: canRunPackageManager ? undefined : `(${mismatch.packageManager} not installed)`,
9443
- description: `Runs ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline-zh@${mismatch.runningVersion}` : `bun add -g ccstatusline-zh@${mismatch.runningVersion}`}`
9595
+ sublabel: canRunPackageManager ? undefined : `(未检测到 ${mismatch.packageManager})`,
9596
+ description: `运行 ${mismatch.packageManager === "npm" ? `npm install -g ccstatusline-zh@${mismatch.runningVersion}` : `bun add -g ccstatusline-zh@${mismatch.runningVersion}`}`
9444
9597
  });
9445
9598
  }
9446
9599
  items.push({
9447
- label: "Exit",
9600
+ label: "退出",
9448
9601
  value: "exit",
9449
- description: `Relaunch manually with ${mismatch.relaunchCommand}`
9602
+ description: `请使用 ${mismatch.relaunchCommand} 手动重新启动`
9450
9603
  });
9451
9604
  return items;
9452
9605
  }
@@ -9540,6 +9693,18 @@ ${commands}
9540
9693
 
9541
9694
  继续?`;
9542
9695
  }
9696
+ function buildSkippedHooksNotice(skipped, continueScreen) {
9697
+ return {
9698
+ title: "配置已保存",
9699
+ message: `未添加 ${skipped.widgetNames.join("、")} 所需的 Claude Code Hook:状态行命令不包含 "ccstatusline",可能属于其他工具。
9700
+
9701
+ ${skipped.statusCommand}
9702
+
9703
+ 如果这是运行 ccstatusline-zh 的包装脚本,请在脚本名称中加入 "ccstatusline"(例如 ~/.claude/ccstatusline-zh-wrapper.sh),通过 ccstatusline-zh "$@" 传递参数,然后重新保存。`,
9704
+ color: "yellow",
9705
+ continueScreen
9706
+ };
9707
+ }
9543
9708
  function clearInstallationMetadata(settings) {
9544
9709
  if (!settings) {
9545
9710
  return settings;
@@ -9547,8 +9712,8 @@ function clearInstallationMetadata(settings) {
9547
9712
  const { installation, ...next } = settings;
9548
9713
  return next;
9549
9714
  }
9550
- function getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings) {
9551
- return isClaudeInstalled && !existingStatusLine && settings.installation ? settings.installation : classifyInstallation(existingStatusLine, settings.installation);
9715
+ function classifyInstalledStatusLine(existingStatusLine, savedInstallation) {
9716
+ return !existingStatusLine && savedInstallation ? savedInstallation : classifyInstallation(existingStatusLine, savedInstallation);
9552
9717
  }
9553
9718
  function trimTrailingSeparators2(filePath) {
9554
9719
  return filePath.replace(/[\\/]+$/, "");
@@ -9639,13 +9804,20 @@ function buildInvalidConfigSaveConfirm(configLoadError, onConfirm, returnScreen
9639
9804
  }
9640
9805
  var App = () => {
9641
9806
  const { exit } = use_app_default();
9807
+ const [devReloadStateFile] = import_react21.useState(() => getDevReloadStateFile2(process.env));
9808
+ const [restored] = import_react21.useState(() => devReloadStateFile ? readDevReloadSnapshot2(devReloadStateFile) : null);
9642
9809
  const [settings, setSettings] = import_react21.useState(null);
9643
9810
  const [originalSettings, setOriginalSettings] = import_react21.useState(null);
9644
9811
  const [hasChanges, setHasChanges] = import_react21.useState(false);
9645
9812
  const [configLoadError, setConfigLoadError] = import_react21.useState(null);
9646
- const [screen, setScreen] = import_react21.useState("main");
9647
- const [selectedLine, setSelectedLine] = import_react21.useState(0);
9648
- const [menuSelections, setMenuSelections] = import_react21.useState({});
9813
+ const [screen, setScreen] = import_react21.useState(restored?.screen ?? "main");
9814
+ const [selectedLine, setSelectedLine] = import_react21.useState(restored?.selectedLine ?? 0);
9815
+ const [previewWidgets, setPreviewWidgets] = import_react21.useState(null);
9816
+ const [menuSelections, setMenuSelections] = import_react21.useState(restored?.menuSelections ?? {});
9817
+ const handleLineSelectionChange = import_react21.useCallback((index) => {
9818
+ setMenuSelections((prev) => ({ ...prev, lines: index }));
9819
+ }, []);
9820
+ const [itemsCursor, setItemsCursor] = import_react21.useState(restored?.itemsCursor ?? 0);
9649
9821
  const [confirmDialog, setConfirmDialog] = import_react21.useState(null);
9650
9822
  const [isClaudeInstalled, setIsClaudeInstalled] = import_react21.useState(false);
9651
9823
  const [terminalWidth, setTerminalWidth] = import_react21.useState(process.stdout.columns || 80);
@@ -9679,9 +9851,10 @@ var App = () => {
9679
9851
  setHasLoadedClaudeStatus(true);
9680
9852
  });
9681
9853
  loadSettings().then((loadedSettings) => {
9682
- source_default.level = loadedSettings.colorLevel;
9683
- setSettings(loadedSettings);
9684
- setOriginalSettings(cloneSettings(loadedSettings));
9854
+ const initialSettings = restored?.settings ?? loadedSettings;
9855
+ source_default.level = initialSettings.colorLevel;
9856
+ setSettings(initialSettings);
9857
+ setOriginalSettings(cloneSettings(restored?.originalSettings ?? loadedSettings));
9685
9858
  setConfigLoadError(getConfigLoadError());
9686
9859
  });
9687
9860
  isInstalled().then(setIsClaudeInstalled).catch(() => {
@@ -9701,13 +9874,24 @@ var App = () => {
9701
9874
  return () => {
9702
9875
  process.stdout.off("resize", handleResize);
9703
9876
  };
9704
- }, []);
9877
+ }, [restored]);
9705
9878
  import_react21.useEffect(() => {
9706
9879
  if (originalSettings) {
9707
9880
  const hasAnyChanges = JSON.stringify(settings) !== JSON.stringify(originalSettings);
9708
9881
  setHasChanges(hasAnyChanges);
9709
9882
  }
9710
9883
  }, [settings, originalSettings]);
9884
+ const loadedOriginalSettings = import_react21.useRef(null);
9885
+ import_react21.useEffect(() => {
9886
+ if (!devReloadStateFile || !originalSettings) {
9887
+ return;
9888
+ }
9889
+ if (!loadedOriginalSettings.current) {
9890
+ loadedOriginalSettings.current = originalSettings;
9891
+ } else if (originalSettings !== loadedOriginalSettings.current) {
9892
+ discardDevReloadSnapshot2(devReloadStateFile);
9893
+ }
9894
+ }, [devReloadStateFile, originalSettings]);
9711
9895
  import_react21.useEffect(() => {
9712
9896
  if (flashMessage) {
9713
9897
  const timer = setTimeout(() => {
@@ -9722,8 +9906,17 @@ var App = () => {
9722
9906
  if (key.ctrl && input === "c") {
9723
9907
  exit();
9724
9908
  }
9909
+ if (devReloadStateFile && key.ctrl && input === "r" && settings && originalSettings) {
9910
+ if (actionInFlightRef.current) {
9911
+ return;
9912
+ }
9913
+ writeDevReloadSnapshot2(devReloadStateFile, { settings, originalSettings, screen, selectedLine, menuSelections, itemsCursor });
9914
+ requestDevReload2();
9915
+ exit();
9916
+ return;
9917
+ }
9725
9918
  if (key.ctrl && input === "s" && settings && screen !== "confirm") {
9726
- const installation = getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings);
9919
+ const installation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, settings.installation) : classifyInstallation(existingStatusLine, settings.installation);
9727
9920
  const activeCommand = installation.method === "pinned" || installation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
9728
9921
  const effectiveInstallation = getPathInferredInstallation(installation, activeCommand);
9729
9922
  const mismatch = getPinnedVersionMismatch(effectiveInstallation, getPackageVersion(), "ccstatusline-zh", versionInstalledThisSession);
@@ -9733,14 +9926,20 @@ var App = () => {
9733
9926
  const performSave = () => {
9734
9927
  (async () => {
9735
9928
  try {
9736
- await saveSettings(settings);
9929
+ const skippedHooks = await saveSettings(settings);
9737
9930
  setOriginalSettings(cloneSettings(settings));
9738
9931
  setHasChanges(false);
9739
9932
  setConfigLoadError(null);
9740
- setFlashMessage({
9741
- text: "✓ 配置已保存",
9742
- color: "green"
9743
- });
9933
+ if (skippedHooks) {
9934
+ setFlashMessage(null);
9935
+ setFlowNotice(buildSkippedHooksNotice(skippedHooks, screen === "flowNotice" ? "main" : screen));
9936
+ setScreen("flowNotice");
9937
+ } else {
9938
+ setFlashMessage({
9939
+ text: "✓ 配置已保存",
9940
+ color: "green"
9941
+ });
9942
+ }
9744
9943
  } catch {
9745
9944
  setFlashMessage({
9746
9945
  text: "✗ 无法保存配置",
@@ -9859,7 +10058,7 @@ ${resolutionWarning}`,
9859
10058
  }, []);
9860
10059
  const handleUpdateCheck = import_react21.useCallback(() => {
9861
10060
  setUpdateCheckerState({ status: "checking" });
9862
- const installation = settings ? getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings) : classifyInstallation(existingStatusLine, undefined);
10061
+ const installation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, settings?.installation) : classifyInstallation(existingStatusLine, settings?.installation);
9863
10062
  const activeCommand = installation.method === "pinned" || installation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
9864
10063
  const effectiveUpdateInstallation = getPathInferredInstallation(installation, activeCommand);
9865
10064
  const currentUpdateVersion = effectiveUpdateInstallation.method === "pinned" && effectiveUpdateInstallation.installedVersion ? effectiveUpdateInstallation.installedVersion : getPackageVersion();
@@ -9966,16 +10165,26 @@ ${resolutionWarning}`,
9966
10165
  setFlashMessage({ text: "配置已导入,请检查后保存", color: "green" });
9967
10166
  setScreen("main");
9968
10167
  }, [importValidation, settings]);
9969
- if (!settings || !hasLoadedClaudeStatus || !hasLoadedInstalledState) {
10168
+ const savedInstallation = settings?.installation;
10169
+ const hasLoaded = settings !== null && hasLoadedClaudeStatus && hasLoadedInstalledState;
10170
+ const installationState = import_react21.useMemo(() => {
10171
+ if (!hasLoaded) {
10172
+ return null;
10173
+ }
10174
+ const currentInstallation = isClaudeInstalled ? classifyInstalledStatusLine(existingStatusLine, savedInstallation) : classifyInstallation(existingStatusLine, savedInstallation);
10175
+ const activeGlobalCommand = currentInstallation.method === "pinned" || currentInstallation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
10176
+ const effectiveInstallation = getPathInferredInstallation(currentInstallation, activeGlobalCommand);
10177
+ const pinnedRelaunchCommand = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager) : null;
10178
+ return { activeGlobalCommand, effectiveInstallation, pinnedRelaunchCommand };
10179
+ }, [commandAvailability, existingStatusLine, hasLoaded, isClaudeInstalled, savedInstallation]);
10180
+ if (!settings || !installationState) {
9970
10181
  return /* @__PURE__ */ jsx_runtime23.jsx(Text, {
9971
10182
  children: "正在加载设置..."
9972
10183
  });
9973
10184
  }
9974
10185
  const runningVersion = getPackageVersion();
9975
- const currentInstallation = getCurrentInstallation(isClaudeInstalled, existingStatusLine, settings);
9976
- const activeGlobalCommand = currentInstallation.method === "pinned" || currentInstallation.method === "self-managed" ? inspectActiveGlobalCommand({ commandAvailability }) : null;
9977
- const effectiveInstallation = getPathInferredInstallation(currentInstallation, activeGlobalCommand);
9978
- const pinnedVersionMismatch = effectiveInstallation.method === "pinned" && effectiveInstallation.packageManager !== "unknown" ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, getPinnedGlobalRelaunchCommand(effectiveInstallation.packageManager), versionInstalledThisSession) : null;
10186
+ const { activeGlobalCommand, effectiveInstallation, pinnedRelaunchCommand } = installationState;
10187
+ const pinnedVersionMismatch = pinnedRelaunchCommand ? getPinnedVersionMismatch(effectiveInstallation, runningVersion, pinnedRelaunchCommand, versionInstalledThisSession) : null;
9979
10188
  const runActionOnce = (action) => {
9980
10189
  if (actionInFlightRef.current) {
9981
10190
  return;
@@ -10162,10 +10371,15 @@ ${GITHUB_REPO_URL}`,
10162
10371
  case "save": {
10163
10372
  const saveAndExit = async () => {
10164
10373
  try {
10165
- await saveSettings(settings);
10374
+ const skippedHooks = await saveSettings(settings);
10166
10375
  setOriginalSettings(cloneSettings(settings));
10167
10376
  setHasChanges(false);
10168
- exit();
10377
+ if (skippedHooks) {
10378
+ setFlowNotice(buildSkippedHooksNotice(skippedHooks, "exit"));
10379
+ setScreen("flowNotice");
10380
+ } else {
10381
+ exit();
10382
+ }
10169
10383
  } catch {
10170
10384
  setFlashMessage({
10171
10385
  text: "✗ 无法保存配置",
@@ -10202,7 +10416,7 @@ ${GITHUB_REPO_URL}`,
10202
10416
  bold: true,
10203
10417
  children: /* @__PURE__ */ jsx_runtime23.jsx(dist_default2, {
10204
10418
  name: "retro",
10205
- children: "CCStatusline Configuration"
10419
+ children: "CCStatusline 配置"
10206
10420
  })
10207
10421
  }),
10208
10422
  /* @__PURE__ */ jsx_runtime23.jsx(Text, {
@@ -10238,9 +10452,11 @@ ${GITHUB_REPO_URL}`,
10238
10452
  };
10239
10453
  const handleLineSelect = (lineIndex) => {
10240
10454
  setSelectedLine(lineIndex);
10455
+ setItemsCursor(0);
10241
10456
  setScreen("items");
10242
10457
  };
10243
10458
  const configWarning = buildConfigLoadWarning(configLoadError);
10459
+ const previewLines = screen === "items" && previewWidgets ? settings.lines.map((line, index) => index === selectedLine ? previewWidgets : line) : settings.lines;
10244
10460
  return /* @__PURE__ */ jsx_runtime23.jsxs(Box_default, {
10245
10461
  flexDirection: "column",
10246
10462
  children: [
@@ -10258,6 +10474,10 @@ ${GITHUB_REPO_URL}`,
10258
10474
  bold: true,
10259
10475
  children: ` | ${runningVersion && `v${runningVersion}`}`
10260
10476
  }),
10477
+ devReloadStateFile && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
10478
+ dimColor: true,
10479
+ children: " 开发重载: Ctrl+R"
10480
+ }),
10261
10481
  flashMessage && /* @__PURE__ */ jsx_runtime23.jsx(Text, {
10262
10482
  color: flashMessage.color,
10263
10483
  bold: true,
@@ -10275,7 +10495,7 @@ ${GITHUB_REPO_URL}`,
10275
10495
  children: `配置文件:${getConfigPath()}`
10276
10496
  }),
10277
10497
  /* @__PURE__ */ jsx_runtime23.jsx(StatusLinePreview, {
10278
- lines: settings.lines,
10498
+ lines: previewLines,
10279
10499
  terminalWidth,
10280
10500
  settings,
10281
10501
  onTruncationChange: setPreviewIsTruncated
@@ -10293,6 +10513,9 @@ ${GITHUB_REPO_URL}`,
10293
10513
  isClaudeInstalled,
10294
10514
  hasChanges,
10295
10515
  initialSelection: menuSelections.main,
10516
+ onSelectionChange: (index) => {
10517
+ setMenuSelections((prev) => ({ ...prev, main: index }));
10518
+ },
10296
10519
  powerlineFontStatus,
10297
10520
  settings,
10298
10521
  installation: effectiveInstallation,
@@ -10310,6 +10533,7 @@ ${GITHUB_REPO_URL}`,
10310
10533
  setScreen("main");
10311
10534
  },
10312
10535
  initialSelection: menuSelections.lines,
10536
+ onSelectionChange: handleLineSelectionChange,
10313
10537
  title: "选择要编辑组件的行",
10314
10538
  allowEditing: true
10315
10539
  }),
@@ -10318,6 +10542,9 @@ ${GITHUB_REPO_URL}`,
10318
10542
  onUpdate: (widgets) => {
10319
10543
  updateLine(selectedLine, widgets);
10320
10544
  },
10545
+ onPreviewChange: setPreviewWidgets,
10546
+ initialSelectedIndex: itemsCursor,
10547
+ onSelectedIndexChange: setItemsCursor,
10321
10548
  onBack: () => {
10322
10549
  setMenuSelections((prev) => ({ ...prev, lines: selectedLine }));
10323
10550
  setScreen("lines");
@@ -10338,6 +10565,7 @@ ${GITHUB_REPO_URL}`,
10338
10565
  setScreen("main");
10339
10566
  },
10340
10567
  initialSelection: menuSelections.lines,
10568
+ onSelectionChange: handleLineSelectionChange,
10341
10569
  title: "选择要编辑颜色的行",
10342
10570
  blockIfPowerlineActive: true,
10343
10571
  settings,
@@ -10403,6 +10631,10 @@ ${GITHUB_REPO_URL}`,
10403
10631
  screen === "flowNotice" && flowNotice && /* @__PURE__ */ jsx_runtime23.jsx(FlowNotice, {
10404
10632
  ...flowNotice,
10405
10633
  onContinue: () => {
10634
+ if (flowNotice.continueScreen === "exit") {
10635
+ exit();
10636
+ return;
10637
+ }
10406
10638
  setScreen(flowNotice.continueScreen);
10407
10639
  setFlowNotice(null);
10408
10640
  }
@@ -10571,7 +10803,12 @@ ${GITHUB_REPO_URL}`,
10571
10803
  };
10572
10804
  function runTUI() {
10573
10805
  process.stdout.write("\x1B[2J\x1B[H");
10574
- render_default(/* @__PURE__ */ jsx_runtime23.jsx(App, {}));
10806
+ const instance = render_default(/* @__PURE__ */ jsx_runtime23.jsx(App, {}));
10807
+ instance.waitUntilExit().finally(() => {
10808
+ if (isDevReloadRequested2()) {
10809
+ process.exit(DEV_RELOAD_EXIT_CODE2);
10810
+ }
10811
+ });
10575
10812
  }
10576
10813
  export {
10577
10814
  runTUI