dsh-git-scm 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -61,7 +61,9 @@ sidebar and works on the checkout of the Session's current working directory.
61
61
  runtime, so this package keeps no LLM dependency.
62
62
  - **Changes**: staged changes and working-tree changes (modified, added,
63
63
  deleted, renamed, copied, conflicting, untracked; an untracked directory is
64
- listed as its files, not as one directory row).
64
+ listed as its files, not as one directory row). File names stay on one line:
65
+ the directory suffix yields first, and a name that still does not fit ends
66
+ with an ellipsis instead of wrapping or dropping its extension.
65
67
  - **Flat list or directory tree**: the staged and working-tree sections open as a
66
68
  flat list; the header's view control switches both to a directory tree whose
67
69
  folders start expanded and collapse on click. Single-child directory chains
@@ -121,7 +123,9 @@ sidebar and works on the checkout of the Session's current working directory.
121
123
  a filterable file list with per-file `+n/−n` counts and the commit totals;
122
124
  opening a file shows its diff for the commit, with one control back to the
123
125
  review. Choosing another commit replaces the review in the same pane.
124
- - **Branches**: every local branch with its upstream and last commit date,
126
+ - **Branches**: every local branch with its upstream and last commit date.
127
+ Long branch names stay on one line and end with an ellipsis when they do not
128
+ fit (the upstream path and relative date yield first),
125
129
  coloured the way VS Code shows them — green `↑n` for local commits the remote
126
130
  does not have, amber `↓n` for remote commits not pulled yet, and a green `▲+`
127
131
  unpublished mark for a branch with no upstream. Green is reserved for work that
package/lib/client.js CHANGED
@@ -1176,6 +1176,27 @@
1176
1176
  /* The remote name stays whole; a long URL ellipsizes against it. */
1177
1177
  .dgscm-row--remote .dgscm-row-name { flex-shrink: 0; }
1178
1178
  .dgscm-row--remote .dgscm-row-dir { flex-shrink: 999; }
1179
+ /* The branch name is the row's identity: the upstream path gives up its width
1180
+ first, so a short name like "main" never collapses to "m...". */
1181
+ .dgscm-row--branch .dgscm-row-dir { flex-shrink: 999; }
1182
+ /* The name is never squeezed by flex rounding: it keeps its natural width
1183
+ while the row fits, the upstream path and relative date yield first, and only
1184
+ a name wider than the space the row can give it ellipsizes on one line. The
1185
+ cap leaves room for the chevron, glyph, tracking counts, hover actions and
1186
+ status flag. */
1187
+ .dgscm-row--branch .dgscm-row-name {
1188
+ flex-shrink: 0;
1189
+ max-width: calc(100% - 170px);
1190
+ min-width: 0;
1191
+ overflow: hidden;
1192
+ text-overflow: ellipsis;
1193
+ white-space: nowrap;
1194
+ }
1195
+ .dgscm-row--branch .dgscm-row-end .dgscm-row-note {
1196
+ flex-shrink: 999;
1197
+ min-width: 0;
1198
+ overflow: hidden;
1199
+ }
1179
1200
  .dgscm-worktree-flag--missing { display: inline-flex; flex: none; color: var(--dsw-alias-state-error-primary); }
1180
1201
  .dgscm-badge--worktree {
1181
1202
  background: color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent);
@@ -1208,6 +1229,18 @@
1208
1229
  the suffix absorbs the shortage first, and the name only truncates once it
1209
1230
  is gone. */
1210
1231
  .dgscm-row--file .dgscm-row-dir { flex-shrink: 999; }
1232
+ /* The file name is never squeezed by flex rounding: it keeps its natural width
1233
+ while the row fits, the directory suffix yields first, and only a name wider
1234
+ than the space the row can give it ellipsizes on one line. The cap leaves
1235
+ room for the glyph, the gaps, the hover actions and the status mark. */
1236
+ .dgscm-row--file .dgscm-row-name {
1237
+ flex-shrink: 0;
1238
+ max-width: calc(100% - 115px);
1239
+ min-width: 0;
1240
+ overflow: hidden;
1241
+ text-overflow: ellipsis;
1242
+ white-space: nowrap;
1243
+ }
1211
1244
  /* Change tree: file rows pad past the folder chevron so a file glyph lines up
1212
1245
  with a folder glyph at the same depth. */
1213
1246
  .dgscm-row--dir { cursor: pointer; }
@@ -1981,6 +2014,22 @@
1981
2014
  /* The message field carries its own model control in the corner. */
1982
2015
  .dgscm-message { position: relative; display: flex; }
1983
2016
  .dgscm-message .dgscm-textarea { flex: 1 1 auto; padding-right: 36px; }
2017
+ /* The commit hint wraps in a narrow panel; this hidden twin measures the
2018
+ wrapped hint (same font and text width as the field) so the field can grow
2019
+ before the placeholder is painted. */
2020
+ .dgscm-message-measure {
2021
+ position: absolute;
2022
+ top: 0;
2023
+ left: 10px;
2024
+ right: 37px;
2025
+ visibility: hidden;
2026
+ pointer-events: none;
2027
+ font: inherit;
2028
+ font-size: 12px;
2029
+ line-height: 17px;
2030
+ white-space: normal;
2031
+ overflow-wrap: anywhere;
2032
+ }
1984
2033
  .dgscm-generate {
1985
2034
  position: absolute;
1986
2035
  top: 5px;
@@ -3279,7 +3328,7 @@
3279
3328
  const nameTone = isLocal ? behind > 0 ? "unpulled" : unpublished ? "unpushed" : null : null;
3280
3329
  const date = relativeTime(branch.date, t);
3281
3330
  return h("div", {
3282
- className: `dgscm-row dgscm-row--clickable${branch.current === true ? " dgscm-row--current" : ""}`,
3331
+ className: `dgscm-row dgscm-row--clickable dgscm-row--branch${branch.current === true ? " dgscm-row--current" : ""}`,
3283
3332
  style: indent(depth),
3284
3333
  role: "button",
3285
3334
  tabIndex: 0,
@@ -4169,6 +4218,7 @@
4169
4218
  const [review, setReview] = useState(null);
4170
4219
  const [searchSignal, setSearchSignal] = useState(0);
4171
4220
  const [refreshing, setRefreshing] = useState(false);
4221
+ const messageHint = summary?.repo?.branch == null ? t("commit.placeholderDetached") : t("commit.placeholder", { branch: summary.repo.branch });
4172
4222
  const autoLayout = sidebarFullscreen && !narrowPreview ? "right" : narrowPreview ? "bottom" : previewLayout;
4173
4223
  const collapsedPane = comparisonCollapsed && view !== null;
4174
4224
  const paneLayout = collapsedPane ? "bottom" : autoLayout;
@@ -4184,6 +4234,7 @@
4184
4234
  const heightRef = useRef(diffHeight);
4185
4235
  const widthRef = useRef(previewWidth);
4186
4236
  const messageRef = useRef(null);
4237
+ const hintRef = useRef(null);
4187
4238
  const generateHoldRef = useRef(null);
4188
4239
  const generateLongPressRef = useRef(false);
4189
4240
  const commitRulesRef = useRef(commitRules);
@@ -4302,14 +4353,36 @@
4302
4353
  loadSeq.current += 1;
4303
4354
  };
4304
4355
  }, [sessionId, load]);
4305
- useEffect(() => {
4356
+ const sizeMessage = useCallback(() => {
4306
4357
  const node = messageRef.current;
4307
4358
  if (node === null) return;
4308
4359
  if (typeof node.scrollHeight !== "number") return;
4360
+ const hint = hintRef.current;
4309
4361
  node.style.height = "auto";
4310
- const max = 118;
4311
- node.style.height = `${Math.min(Math.max(node.scrollHeight, 34), max)}px`;
4312
- }, [message, phase]);
4362
+ const hintHeight = hint === null ? 0 : hint.scrollHeight + 16;
4363
+ const needed = Math.max(node.scrollHeight + 2, hintHeight, 34);
4364
+ node.style.height = `${Math.min(needed, 118)}px`;
4365
+ }, [
4366
+ message,
4367
+ messageHint,
4368
+ phase
4369
+ ]);
4370
+ useEffect(() => {
4371
+ sizeMessage();
4372
+ }, [sizeMessage]);
4373
+ useEffect(() => {
4374
+ const host = messageRef.current?.parentElement ?? null;
4375
+ if (host === null || typeof ResizeObserver !== "function") return void 0;
4376
+ let lastWidth = 0;
4377
+ const observer = new ResizeObserver((entries) => {
4378
+ const width = entries?.[0]?.contentRect?.width ?? 0;
4379
+ if (Math.abs(width - lastWidth) < .5) return;
4380
+ lastWidth = width;
4381
+ sizeMessage();
4382
+ });
4383
+ observer.observe(host);
4384
+ return () => observer.disconnect();
4385
+ }, [sizeMessage]);
4313
4386
  useEffect(() => {
4314
4387
  if (phase !== "ready") return void 0;
4315
4388
  const timer = setInterval(() => {
@@ -6734,7 +6807,7 @@
6734
6807
  className: "dgscm-textarea",
6735
6808
  rows: 1,
6736
6809
  value: message,
6737
- placeholder: repo.branch === null ? t("commit.placeholderDetached") : t("commit.placeholder", { branch: repo.branch }),
6810
+ placeholder: messageHint,
6738
6811
  disabled: working,
6739
6812
  onChange: (event) => setMessage(event.target.value),
6740
6813
  onKeyDown: (event) => {
@@ -6743,7 +6816,11 @@
6743
6816
  commitTracked();
6744
6817
  }
6745
6818
  }
6746
- }), h("button", {
6819
+ }), message.length === 0 ? h("span", {
6820
+ ref: hintRef,
6821
+ className: "dgscm-message-measure",
6822
+ "aria-hidden": "true"
6823
+ }, messageHint) : null, h("button", {
6747
6824
  type: "button",
6748
6825
  className: `dgscm-generate${generating ? " dgscm-generate--busy" : ""}`,
6749
6826
  title: generating ? t("commit.generating") : `${message.trim().length > 0 ? t("action.improveMessage") : t("action.generateMessage")} · ${t("commit.rulesHint")}`,