@eliya-oss/agent-diff 0.1.0-alpha.13 → 0.1.0-alpha.15

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/main.js +272 -25
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Pan the diff sideways to read past the right edge.
8
+
9
+ - The footer keeps the way out visible on a narrow terminal.
10
+
11
+ - Wrapping keeps every character and is remembered between sessions.
12
+
13
+ ## 0.1.0-alpha.14
14
+
15
+ ### Patch Changes
16
+
17
+ - V selects the change under the cursor, o grows a selection from its other end, and g and G reach the ends of the worktree list.
18
+
19
+ - w wraps long lines in the diff, and the cursor gutter stops at the last line.
20
+
3
21
  ## 0.1.0-alpha.13
4
22
 
5
23
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10808,6 +10808,7 @@ const inboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "i
10808
10808
  const outboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "outbox.jsonl");
10809
10809
  const statePath = (root, worktreePath) => join(branchDir(root, worktreePath), "state.json");
10810
10810
  const layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
10811
+ const settingsPath = (root) => join(root, "settings.json");
10811
10812
  const reportsDir = (root) => join(root, "reports");
10812
10813
  const reportPath = (root, stamp) => join(reportsDir(root), `${stamp}.md`);
10813
10814
  //#endregion
@@ -10832,6 +10833,10 @@ const readOptional = fn("Store.readOptional")(function* (path) {
10832
10833
  }).pipe(map(some), catchTag("StoreUnreadable", () => missing));
10833
10834
  });
10834
10835
  const missing = succeed(none());
10836
+ const parseSettings = (raw) => {
10837
+ const parsed = JSON.parse(raw);
10838
+ return typeof parsed.wrap === "boolean" ? { wrap: parsed.wrap } : {};
10839
+ };
10835
10840
  const parseBatches = (raw) => raw.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
10836
10841
  const parseAnswers = (raw) => raw.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
10837
10842
  const parseState = (raw) => ({
@@ -10881,6 +10886,28 @@ const cursorOps = (state, saveState, inbox) => {
10881
10886
  })
10882
10887
  };
10883
10888
  };
10889
+ const settingsOps = (root) => {
10890
+ return {
10891
+ settings: fn("Store.settings")(function* () {
10892
+ const raw = yield* readOptional(settingsPath(root));
10893
+ return match$2(raw, {
10894
+ onNone: () => ({}),
10895
+ onSome: parseSettings
10896
+ });
10897
+ }),
10898
+ saveSettings: fn("Store.saveSettings")(function* (next) {
10899
+ const path = settingsPath(root);
10900
+ yield* ensureDir(root);
10901
+ yield* tryPromise({
10902
+ try: () => writeFile(path, JSON.stringify(next), "utf8"),
10903
+ catch: (cause) => new StoreUnwritable({
10904
+ path,
10905
+ reason: String(cause)
10906
+ })
10907
+ });
10908
+ })
10909
+ };
10910
+ };
10884
10911
  const reportOps = (root) => fn("Store.saveReport")(function* (stamp, text) {
10885
10912
  const path = reportPath(root, stamp);
10886
10913
  yield* ensureDir(reportsDir(root));
@@ -10979,6 +11006,7 @@ const makeStore = (root) => {
10979
11006
  state,
10980
11007
  saveState,
10981
11008
  saveReport: reportOps(root),
11009
+ ...settingsOps(root),
10982
11010
  ...answerOps(root),
10983
11011
  ...layersOps(root),
10984
11012
  ...cursors
@@ -11282,6 +11310,14 @@ const fileSource = fn("Cli.fileSource")(function* (repo, branch, file) {
11282
11310
  const found = yield* git.source(worktree, file);
11283
11311
  return getOrElse(found, () => []);
11284
11312
  });
11313
+ const saveWrap = fn("Cli.saveWrap")(function* (wrap) {
11314
+ const store = yield* Store;
11315
+ const current = yield* store.settings();
11316
+ yield* store.saveSettings({
11317
+ ...current,
11318
+ wrap
11319
+ });
11320
+ });
11285
11321
  //#endregion
11286
11322
  //#region src/domain/layers/model.ts
11287
11323
  const REMAINDER_TITLE = "not in any layer";
@@ -12414,6 +12450,8 @@ const initialState = (branches) => ({
12414
12450
  revealed: [],
12415
12451
  focus: "diff",
12416
12452
  navOpen: true,
12453
+ wrap: false,
12454
+ pan: 0,
12417
12455
  layers: [],
12418
12456
  layersStale: false,
12419
12457
  pulls: {},
@@ -12644,6 +12682,19 @@ const hunkStarts = (state) => {
12644
12682
  const patch = selectedPatch(state);
12645
12683
  return patch === void 0 ? [] : patch.hunks.map((hunk) => hunk.startRow);
12646
12684
  };
12685
+ const changeAround = (state) => {
12686
+ const rows = selectedPatch(state)?.rows ?? [];
12687
+ const changed = (at) => {
12688
+ const row = rows[at];
12689
+ return row !== void 0 && row.kind !== "context";
12690
+ };
12691
+ if (!changed(state.cursor)) return void 0;
12692
+ let first = state.cursor;
12693
+ let last = state.cursor;
12694
+ while (changed(first - 1)) first -= 1;
12695
+ while (changed(last + 1)) last += 1;
12696
+ return [first, last];
12697
+ };
12647
12698
  const nextUnreviewed = (state, from) => {
12648
12699
  const order = fileOrder(state);
12649
12700
  const start = Math.max(0, order.indexOf(from));
@@ -12854,6 +12905,52 @@ const commands = [
12854
12905
  screens: ["review"],
12855
12906
  hint: "zoom"
12856
12907
  }),
12908
+ command({
12909
+ action: "branch.first",
12910
+ title: "Go to the first worktree",
12911
+ category: "Branches",
12912
+ keys: ["g"],
12913
+ screens: ["branches"]
12914
+ }),
12915
+ command({
12916
+ action: "branch.last",
12917
+ title: "Go to the last worktree",
12918
+ category: "Branches",
12919
+ keys: ["G"],
12920
+ screens: ["branches"]
12921
+ }),
12922
+ command({
12923
+ action: "select.hunk",
12924
+ title: "Select the change under the cursor",
12925
+ keys: ["V"],
12926
+ screens: ["review"]
12927
+ }),
12928
+ command({
12929
+ action: "select.swap",
12930
+ title: "Grow the selection from its other end",
12931
+ keys: ["o"],
12932
+ screens: ["review"]
12933
+ }),
12934
+ command({
12935
+ action: "wrap.toggle",
12936
+ title: "Wrap long lines",
12937
+ category: "General",
12938
+ keys: ["w"],
12939
+ screens: ["review"],
12940
+ hint: "wrap"
12941
+ }),
12942
+ command({
12943
+ action: "pan.right",
12944
+ title: "Pan the diff right",
12945
+ keys: [">"],
12946
+ screens: ["review"]
12947
+ }),
12948
+ command({
12949
+ action: "pan.left",
12950
+ title: "Pan the diff left",
12951
+ keys: ["<"],
12952
+ screens: ["review"]
12953
+ }),
12857
12954
  command({
12858
12955
  action: "review.reload",
12859
12956
  title: "Read the branch again",
@@ -13159,6 +13256,14 @@ const layerComment = (state, delta) => {
13159
13256
  if (file !== void 0) return atComment(state, file, delta);
13160
13257
  return here.length > 0 ? state : withNotice(state, "no comments yet");
13161
13258
  };
13259
+ const PAN_STEP = 8;
13260
+ const panned = (state, delta) => {
13261
+ if (state.wrap) return withNotice(state, "wrapping is on, so there is nothing to pan");
13262
+ return {
13263
+ ...state,
13264
+ pan: Math.max(0, state.pan + delta)
13265
+ };
13266
+ };
13162
13267
  const movePending = (state, delta) => ({
13163
13268
  ...state,
13164
13269
  pendingIndex: clamp(state.pendingIndex + delta, 0, Math.max(0, state.pending.length - 1))
@@ -13222,6 +13327,25 @@ const moveFile = (state, delta) => ({
13222
13327
  anchorRow: 0,
13223
13328
  selecting: false
13224
13329
  });
13330
+ const selectHunk = (state) => {
13331
+ const found = changeAround(state);
13332
+ if (found === void 0) return withNotice(state, "no change under the cursor");
13333
+ return withCursorVisible({
13334
+ ...state,
13335
+ selecting: true,
13336
+ anchorRow: found[0],
13337
+ cursor: found[1]
13338
+ });
13339
+ };
13340
+ const swapEnds = (state) => state.selecting ? withCursorVisible({
13341
+ ...state,
13342
+ anchorRow: state.cursor,
13343
+ cursor: state.anchorRow
13344
+ }) : state;
13345
+ const atBranch = (state, at) => ({
13346
+ ...state,
13347
+ branchIndex: clamp(at, 0, Math.max(0, state.branches.length - 1))
13348
+ });
13225
13349
  const startSelection = (state) => ({
13226
13350
  ...state,
13227
13351
  selecting: true,
@@ -13278,6 +13402,8 @@ const movePalette = (state, delta) => ({
13278
13402
  const paletteMatches = (state) => searchCommands(state.returnTo, state.query);
13279
13403
  const paletteChoice = (state) => paletteMatches(state)[state.paletteIndex]?.action;
13280
13404
  const transitions = {
13405
+ "branch.first": (state) => atBranch(state, 0),
13406
+ "branch.last": (state) => atBranch(state, state.branches.length - 1),
13281
13407
  "branch.next": (state) => moveBranch(state, 1),
13282
13408
  "branch.prev": (state) => moveBranch(state, -1),
13283
13409
  "branch.open": (state) => state,
@@ -13296,6 +13422,8 @@ const transitions = {
13296
13422
  "file.next": (state) => moveFile(state, 1),
13297
13423
  "file.prev": (state) => moveFile(state, -1),
13298
13424
  "select.start": startSelection,
13425
+ "select.hunk": selectHunk,
13426
+ "select.swap": swapEnds,
13299
13427
  "compose.open": openCompose,
13300
13428
  "compose.submit": (state) => state,
13301
13429
  "compose.stage": (state) => state,
@@ -13319,6 +13447,13 @@ const transitions = {
13319
13447
  navOpen: !state.navOpen,
13320
13448
  focus: "diff"
13321
13449
  }),
13450
+ "wrap.toggle": (state) => ({
13451
+ ...state,
13452
+ wrap: !state.wrap,
13453
+ pan: 0
13454
+ }),
13455
+ "pan.right": (state) => panned(state, PAN_STEP),
13456
+ "pan.left": (state) => panned(state, -8),
13322
13457
  "review.reload": (state) => state,
13323
13458
  "rail.toggle": toggleRail,
13324
13459
  "file.vouch": (state) => state,
@@ -13390,6 +13525,10 @@ const withPending = (state, pending, screen) => ({
13390
13525
  staged: pending.length,
13391
13526
  screen
13392
13527
  });
13528
+ const panBy = (state, delta) => state.wrap ? state : {
13529
+ ...state,
13530
+ pan: Math.max(0, state.pan + delta)
13531
+ };
13393
13532
  const withSent = (state, sent) => ({
13394
13533
  ...state,
13395
13534
  sent
@@ -13662,6 +13801,33 @@ const ANSWER_MARK = "↳";
13662
13801
  const OVERSCAN = 2;
13663
13802
  const SIGN_WIDTH = 2;
13664
13803
  const SCROLL_ROWS = 3;
13804
+ const PAN_COLUMNS = 8;
13805
+ const WAYS = {
13806
+ up: {
13807
+ step: -1,
13808
+ across: false
13809
+ },
13810
+ down: {
13811
+ step: 1,
13812
+ across: false
13813
+ },
13814
+ left: {
13815
+ step: -1,
13816
+ across: true
13817
+ },
13818
+ right: {
13819
+ step: 1,
13820
+ across: true
13821
+ }
13822
+ };
13823
+ const notchesIn = (event) => Math.max(1, event.scroll?.delta ?? 1);
13824
+ const wheelTo = (event, handlers) => {
13825
+ const way = WAYS[event.scroll?.direction ?? ""];
13826
+ if (way === void 0) return;
13827
+ const step = way.step * notchesIn(event);
13828
+ if (way.across || event.modifiers?.shift === true) handlers.pan(step * PAN_COLUMNS);
13829
+ else handlers.scroll(step * SCROLL_ROWS);
13830
+ };
13665
13831
  const SIGNS = {
13666
13832
  added: {
13667
13833
  text: " +",
@@ -13688,6 +13854,7 @@ var DiffView = class {
13688
13854
  display = [];
13689
13855
  starts = /* @__PURE__ */ new Map();
13690
13856
  fitted = 1;
13857
+ wrapped = false;
13691
13858
  constructor(renderer) {
13692
13859
  this.code = new CodeRenderable(renderer, {
13693
13860
  id: "diff-code",
@@ -13754,12 +13921,7 @@ var DiffView = class {
13754
13921
  return this.numbers;
13755
13922
  }
13756
13923
  listenTo(handlers) {
13757
- this.numbers.onMouseScroll = (event) => {
13758
- const way = event.scroll?.direction;
13759
- if (way !== "up" && way !== "down") return;
13760
- const size = Math.max(1, event.scroll?.delta ?? 1) * SCROLL_ROWS;
13761
- handlers.scroll(way === "up" ? -size : size);
13762
- };
13924
+ this.numbers.onMouseScroll = (event) => wheelTo(event, handlers);
13763
13925
  this.numbers.onMouseDown = (event) => handlers.down(event.y);
13764
13926
  this.numbers.onMouseDrag = (event) => handlers.drag(event.y);
13765
13927
  this.numbers.onMouseDragEnd = (event) => handlers.dragEnd(event.y);
@@ -13809,18 +13971,74 @@ var DiffView = class {
13809
13971
  const spans = noteSpans(this.display);
13810
13972
  this.code.onHighlight = (highlights) => [...highlights.filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
13811
13973
  }
13812
- rowAt(display) {
13813
- const at = Math.max(0, Math.min(this.display.length - 1, display));
13974
+ setWrap(on) {
13975
+ if (on !== this.wrapped) {
13976
+ this.wrapped = on;
13977
+ this.code.wrapMode = on ? "word" : "none";
13978
+ this.code.requestRender();
13979
+ this.numbers.requestRender();
13980
+ }
13981
+ this.fitWrapWidth();
13982
+ }
13983
+ setPan(columns) {
13984
+ const wanted = this.wrapped ? 0 : Math.max(0, Math.min(this.code.maxScrollX, columns));
13985
+ if (this.code.scrollX !== wanted) this.code.scrollX = wanted;
13986
+ if (this.pinned.scrollX !== wanted) this.pinned.scrollX = wanted;
13987
+ }
13988
+ panned() {
13989
+ return this.code.scrollX;
13990
+ }
13991
+ fitWrapWidth() {
13992
+ const room = this.numbers.width - Math.max(0, this.code.x - this.numbers.x);
13993
+ const wanted = this.wrapped && room > 0 ? room : "100%";
13994
+ if (this.code.width !== wanted) this.code.width = wanted;
13995
+ }
13996
+ sources() {
13997
+ const reported = this.code.lineInfo?.lineSources;
13998
+ return this.wrapped && reported !== void 0 && reported.length > 0 ? reported : [];
13999
+ }
14000
+ lineAt(visual) {
14001
+ const sources = this.sources();
14002
+ if (sources.length === 0) return visual;
14003
+ return sources[Math.max(0, Math.min(sources.length - 1, visual))] ?? visual;
14004
+ }
14005
+ visualOf(line) {
14006
+ const sources = this.sources();
14007
+ if (sources.length === 0) return line;
14008
+ let low = 0;
14009
+ let high = sources.length;
14010
+ while (low < high) {
14011
+ const mid = low + high >> 1;
14012
+ if ((sources[mid] ?? 0) < line) low = mid + 1;
14013
+ else high = mid;
14014
+ }
14015
+ return low;
14016
+ }
14017
+ tallest() {
14018
+ return this.sources().length === 0 ? this.display.length : this.sources().length;
14019
+ }
14020
+ drawn() {
14021
+ return this.tallest();
14022
+ }
14023
+ rowAt(visual) {
14024
+ const line = this.lineAt(visual);
14025
+ const at = Math.max(0, Math.min(this.display.length - 1, line));
13814
14026
  return this.display[at]?.row ?? 0;
13815
14027
  }
13816
- isComment(display) {
13817
- const entry = this.display[display];
14028
+ isComment(visual) {
14029
+ const entry = this.display[this.lineAt(visual)];
13818
14030
  return entry?.comment === true || entry?.prose === true;
13819
14031
  }
14032
+ isRunOn(visual) {
14033
+ const sources = this.sources();
14034
+ if (sources.length === 0) return false;
14035
+ return visual > 0 && sources[visual] === sources[visual - 1];
14036
+ }
13820
14037
  scrollTo(row, cursor) {
13821
- const highest = Math.max(0, this.display.length - this.rows());
13822
- const wanted = this.starts.get(row) ?? row;
13823
- const at = this.starts.get(cursor);
14038
+ const highest = Math.max(0, this.tallest() - this.rows());
14039
+ const wanted = this.visualOf(this.starts.get(row) ?? row);
14040
+ const line = this.starts.get(cursor);
14041
+ const at = line === void 0 ? void 0 : this.visualOf(line);
13824
14042
  const kept = cursor >= row && cursor < row + this.rows() && at !== void 0 ? Math.max(wanted, at - this.rows() + 1) : wanted;
13825
14043
  const clamped = Math.max(0, Math.min(highest, kept));
13826
14044
  if (this.code.scrollY !== clamped) this.code.scrollY = clamped;
@@ -13828,8 +14046,9 @@ var DiffView = class {
13828
14046
  }
13829
14047
  paint(paintOf, from, rows) {
13830
14048
  const colors = /* @__PURE__ */ new Map();
13831
- const last = Math.min(this.display.length, from + rows + OVERSCAN);
13832
- for (let index = Math.max(0, from - OVERSCAN); index < last; index++) {
14049
+ const first = this.lineAt(Math.max(0, from - OVERSCAN));
14050
+ const last = Math.min(this.display.length, this.lineAt(from + rows + OVERSCAN) + 1);
14051
+ for (let index = first; index < last; index++) {
13833
14052
  const entry = this.display[index];
13834
14053
  if (entry === void 0) continue;
13835
14054
  const paint = entry.comment || entry.prose ? NOTE_PAINT : paintOf(entry.row);
@@ -14341,7 +14560,8 @@ const headerParts = (state, branch, path) => [
14341
14560
  state.vouched.length === 0 ? "" : reviewedCount(state),
14342
14561
  state.staged === 0 ? "" : `${state.staged} staged`,
14343
14562
  contextLabel(state.context),
14344
- hiddenLines(state) === 0 ? "" : `⋯ ${hiddenLines(state)} lines hidden`
14563
+ hiddenLines(state) === 0 ? "" : `⋯ ${hiddenLines(state)} lines hidden`,
14564
+ state.pan === 0 ? "" : `→ ${state.pan} columns`
14345
14565
  ];
14346
14566
  const fallbackScope = (state, top) => {
14347
14567
  const scope = (selectedPatch(state)?.hunks.findLast((hunk) => hunk.startRow < top))?.scope ?? "";
@@ -14467,6 +14687,7 @@ var Screen = class {
14467
14687
  this.mouse = mouse;
14468
14688
  this.view.listenTo({
14469
14689
  scroll: (delta) => this.mouse?.onScroll(delta),
14690
+ pan: (delta) => this.mouse?.onPan(delta),
14470
14691
  down: (y) => {
14471
14692
  this.dragFrom = this.rowAtY(y);
14472
14693
  this.mouse?.onDrag(this.dragFrom, this.dragFrom, false);
@@ -14545,15 +14766,15 @@ var Screen = class {
14545
14766
  const readout = selectionReadout(state);
14546
14767
  this.lead = readout.length === 0 ? 0 : readout.length + 3;
14547
14768
  const lead = readout.length === 0 ? [] : [fg(palette.muted)(`${readout} `)];
14548
- if (state.notice.length === 0) return new StyledText([...lead, ...this.chipRow().chunks]);
14549
- const tail = ` ${state.notice}`;
14769
+ const tail = state.notice.length === 0 ? "" : ` ${state.notice}`;
14550
14770
  const width = this.footer.width > 0 ? this.footer.width : this.renderer.width;
14551
14771
  const room = Math.max(0, width - this.lead - tail.length);
14552
14772
  const chips = keptWithin(this.chipRow().chunks, room);
14773
+ const notice = tail.length === 0 ? [] : [fg(palette.attention)(tail)];
14553
14774
  return new StyledText([
14554
14775
  ...lead,
14555
14776
  ...chips,
14556
- fg(palette.attention)(tail)
14777
+ ...notice
14557
14778
  ]);
14558
14779
  }
14559
14780
  paneRoom() {
@@ -14587,6 +14808,8 @@ var Screen = class {
14587
14808
  if (shown === void 0) return;
14588
14809
  const patch = shown.patch;
14589
14810
  this.paintSticky(state, state.top);
14811
+ this.view.setWrap(state.wrap);
14812
+ this.view.setPan(state.pan);
14590
14813
  this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
14591
14814
  this.view.fit(this.diffScroll.height);
14592
14815
  const height = this.view.rows();
@@ -14750,8 +14973,10 @@ var Screen = class {
14750
14973
  paintGutter(state, top, height) {
14751
14974
  const [from, to] = selectionRange(state);
14752
14975
  const marked = markedRows(state);
14976
+ const drawn = this.view.drawn();
14977
+ const bare = (visual) => visual >= drawn || this.view.isComment(visual) || this.view.isRunOn(visual);
14753
14978
  const rows = Array.from({ length: height }, (_, index) => {
14754
- if (this.view.isComment(top + index)) return ` `;
14979
+ if (bare(top + index)) return ` `;
14755
14980
  const row = this.view.rowAt(top + index);
14756
14981
  return `${row === state.cursor || state.selecting && row >= from && row <= to ? marks().cursor : " "}${marked.has(row) ? marks().comment : " "}`;
14757
14982
  });
@@ -14858,21 +15083,28 @@ var App = class {
14858
15083
  noticeMs;
14859
15084
  sessionPath;
14860
15085
  remembered = "";
15086
+ wrapKept = false;
14861
15087
  keys = [];
14862
15088
  fading;
14863
15089
  wheel = 0;
15090
+ sideways = 0;
14864
15091
  constructor(options) {
14865
15092
  this.renderer = options.renderer;
14866
15093
  this.repo = options.repo;
14867
15094
  this.run = options.run;
14868
15095
  this.noticeMs = options.noticeMs ?? 2200;
14869
15096
  this.sessionPath = options.sessionPath;
15097
+ this.wrapKept = options.wrap === true;
14870
15098
  const { branches, renderer } = options;
14871
- this.state = initialState(branches);
15099
+ this.state = {
15100
+ ...initialState(branches),
15101
+ wrap: options.wrap === true
15102
+ };
14872
15103
  this.screen = new Screen(renderer, options.repo);
14873
15104
  this.screen.update(this.state);
14874
15105
  this.screen.listen({
14875
15106
  onScroll: (delta) => this.onWheel(delta),
15107
+ onPan: (delta) => this.onPanWheel(delta),
14876
15108
  onDrag: (from, to) => this.commit(draggedTo(this.measured(), from, to)),
14877
15109
  onChip: (key) => this.dispatchTask(() => this.onKey(asKey(key)))
14878
15110
  });
@@ -14904,6 +15136,11 @@ var App = class {
14904
15136
  });
14905
15137
  await this.loadSource();
14906
15138
  }
15139
+ rememberWrap(next) {
15140
+ if (next.wrap === this.wrapKept) return;
15141
+ this.wrapKept = next.wrap;
15142
+ this.run(saveWrap(next.wrap)).catch(() => void 0);
15143
+ }
14907
15144
  rememberPlace(next) {
14908
15145
  if (this.sessionPath === void 0 || next.screen !== "review") return;
14909
15146
  const session = sessionOf(next);
@@ -14928,11 +15165,18 @@ var App = class {
14928
15165
  this.wheel += delta;
14929
15166
  this.renderer.requestRender();
14930
15167
  }
15168
+ onPanWheel(delta) {
15169
+ this.sideways += delta;
15170
+ this.renderer.requestRender();
15171
+ }
14931
15172
  applyWheel() {
14932
- const delta = this.wheel;
14933
- if (delta === 0) return;
15173
+ const down = this.wheel;
15174
+ const across = this.sideways;
15175
+ if (down === 0 && across === 0) return;
14934
15176
  this.wheel = 0;
14935
- this.commit(scrolled(this.measured(), delta));
15177
+ this.sideways = 0;
15178
+ const moved = down === 0 ? this.measured() : scrolled(this.measured(), down);
15179
+ this.commit(across === 0 ? moved : panBy(moved, across));
14936
15180
  }
14937
15181
  syncGeometry() {
14938
15182
  const rows = this.screen.viewportRows();
@@ -14952,6 +15196,7 @@ var App = class {
14952
15196
  const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
14953
15197
  this.state = next;
14954
15198
  this.rememberPlace(next);
15199
+ this.rememberWrap(next);
14955
15200
  this.screen.update(next);
14956
15201
  if (appeared) this.fade();
14957
15202
  }
@@ -15261,6 +15506,7 @@ const launch = fn("Tui.launch")(function* (repo, renderer, noticeMs, sessionPath
15261
15506
  const context$2 = yield* context();
15262
15507
  const branches = yield* listBranches(repo);
15263
15508
  const resume = sessionPath === void 0 ? void 0 : yield* promise(() => readSession(sessionPath));
15509
+ const settings = yield* (yield* Store).settings();
15264
15510
  return new App({
15265
15511
  renderer,
15266
15512
  repo,
@@ -15268,7 +15514,8 @@ const launch = fn("Tui.launch")(function* (repo, renderer, noticeMs, sessionPath
15268
15514
  branches,
15269
15515
  noticeMs,
15270
15516
  sessionPath,
15271
- resume
15517
+ resume,
15518
+ wrap: settings.wrap === true
15272
15519
  });
15273
15520
  });
15274
15521
  const untilDestroyed = (renderer) => callback((resume) => {
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "bin": {
22
22
  "adiff": "./bin/adiff.js"
23
23
  },
24
- "version": "0.1.0-alpha.13",
24
+ "version": "0.1.0-alpha.15",
25
25
  "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
26
26
  "license": "MIT",
27
27
  "repository": {