pisesh 0.1.7 → 0.1.9

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.9] — 2026-06-03
6
+
7
+ ### Fixed
8
+ - Name / cwd editor (`e`) now has a real caret. Arrow keys (and `Home` / `End`) move inside the text you already typed, so you can insert or delete in the middle instead of only at the end. Backspace, forward `Delete`, and inserts all act at the caret. Cursor moves by whole code points, so CJK and emoji never get split.
9
+
5
10
  ## [0.1.4] — 2026-06-03
6
11
 
7
12
  ### Added
package/README.md CHANGED
@@ -221,6 +221,22 @@ If pisesh saves you context-switching time or just makes pi nicer to live in, su
221
221
  - [interactive-shell example extension](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/examples/extensions/interactive-shell.ts), the pattern reference for the `ui.custom` + `tui.stop` TTY handoff.
222
222
  - Inspiration for the favorites + tabs UX: [droid CLI](https://github.com/factory-ai/droid) and tmux's [sesh](https://github.com/joshmedeski/sesh).
223
223
 
224
+ ## Contributors
225
+
226
+ Thanks to everyone who helped make pisesh better 🙏
227
+
228
+ <a href="https://github.com/Blue-B"><img src="https://github.com/Blue-B.png?size=80" width="80" alt="Blue-B" title="Blue-B" /></a>
229
+
230
+ ## Repository activity
231
+
232
+ ![Repobeats analytics image](https://repobeats.axiom.co/api/embed/a21cb8addd5d2f0ea4ec229c69da5b23855911a8.svg "Repobeats analytics image")
233
+
234
+ ## Star History
235
+
236
+ <a href="https://star-history.com/#Blue-B/pisesh&Date">
237
+ <img src="https://api.star-history.com/svg?repos=Blue-B/pisesh&type=Date&v=20260531" alt="Star History Chart" width="600" />
238
+ </a>
239
+
224
240
  ## License
225
241
 
226
242
  MIT © [Blue-B](https://github.com/Blue-B). See [LICENSE](LICENSE).
package/bin/pisesh CHANGED
@@ -235,6 +235,7 @@ let mode = 'list'; // list | filter | details | edit | browse
235
235
  // edit mode state (title text editor)
236
236
  let editField = ''; // 'title' | 'cwd'
237
237
  let editBuffer = '';
238
+ let editCursor = 0; // caret position (code-point index into editBuffer)
238
239
  let editTarget = null; // the session being edited
239
240
  // browse mode state (arrow-key cwd directory picker)
240
241
  let browseDir = ''; // directory currently being browsed (absolute)
@@ -477,7 +478,15 @@ function renderEdit() {
477
478
  out += '\n';
478
479
 
479
480
  out += ' ' + A.B + (editField === 'cwd' ? 'New cwd' : 'New title') + ':' + A.R + '\n';
480
- out += ' ' + A.cyn + '›' + A.R + ' ' + editBuffer + A.I + ' ' + A.R + '\n';
481
+ {
482
+ // Render the caret in place: text before it, the inverse-highlighted char
483
+ // under it (or a trailing inverse space at end), then the text after it.
484
+ const ch = [...editBuffer];
485
+ const before = ch.slice(0, editCursor).join('');
486
+ const under = editCursor < ch.length ? ch[editCursor] : ' ';
487
+ const after = ch.slice(editCursor + 1).join('');
488
+ out += ' ' + A.cyn + '›' + A.R + ' ' + before + A.I + under + A.R + after + '\n';
489
+ }
481
490
  if (editField === 'cwd') {
482
491
  const exists = editBuffer.trim() && fs.existsSync(editBuffer.trim());
483
492
  out += ' ' + A.D + (editBuffer.trim()
@@ -491,6 +500,7 @@ function renderEdit() {
491
500
 
492
501
  out += '\n' + A.gry + '─'.repeat(Math.max(1, W - 1)) + A.R + '\n';
493
502
  out += ' ' + A.D + 'Enter' + A.R + ' save '
503
+ + A.D + '←→' + A.R + ' move '
494
504
  + A.D + 'Ctrl-U' + A.R + ' clear '
495
505
  + A.D + 'Esc' + A.R + ' cancel' + '\n';
496
506
  process.stdout.write(out);
@@ -654,6 +664,7 @@ function startEdit(s, field) {
654
664
  editTarget = s;
655
665
  editField = field;
656
666
  editBuffer = field === 'cwd' ? (s.cwdOverride || s.cwd || '') : (s.titleOverride || '');
667
+ editCursor = [...editBuffer].length; // start with the caret at the end
657
668
  mode = 'edit';
658
669
  }
659
670
 
@@ -667,10 +678,30 @@ function handleEdit(str, key) {
667
678
  editTarget = null;
668
679
  return;
669
680
  }
670
- if (k === 'backspace') { editBuffer = editBuffer.slice(0, -1); return; }
671
- if (key.ctrl && k === 'u') { editBuffer = ''; return; }
681
+ // Operate on code points so CJK / emoji never get split mid-character.
682
+ const chars = [...editBuffer];
683
+ if (editCursor > chars.length) editCursor = chars.length;
684
+ // Move the caret inside the text the user already typed.
685
+ if (k === 'left') { editCursor = Math.max(0, editCursor - 1); return; }
686
+ if (k === 'right') { editCursor = Math.min(chars.length, editCursor + 1); return; }
687
+ if (k === 'home' || (key.ctrl && k === 'a')) { editCursor = 0; return; }
688
+ if (k === 'end' || (key.ctrl && k === 'e')) { editCursor = chars.length; return; }
689
+ if (k === 'backspace') {
690
+ if (editCursor > 0) { chars.splice(editCursor - 1, 1); editCursor--; editBuffer = chars.join(''); }
691
+ return;
692
+ }
693
+ if (k === 'delete') { // forward delete (char under the caret)
694
+ if (editCursor < chars.length) { chars.splice(editCursor, 1); editBuffer = chars.join(''); }
695
+ return;
696
+ }
697
+ if (key.ctrl && k === 'u') { editBuffer = ''; editCursor = 0; return; }
672
698
  // Accept any printable char (incl. spaces, '/', CJK) but not control combos.
673
- if (str && !key.ctrl && str !== '\r' && str !== '\n' && str !== '\t') editBuffer += str;
699
+ if (str && !key.ctrl && str !== '\r' && str !== '\n' && str !== '\t') {
700
+ const ins = [...str];
701
+ chars.splice(editCursor, 0, ...ins);
702
+ editCursor += ins.length;
703
+ editBuffer = chars.join('');
704
+ }
674
705
  }
675
706
 
676
707
  // ── cwd directory browser (arrow-key picker) ──────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pisesh",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Bookmark, search, and resume pi coding-agent sessions with a fast keyboard-driven TUI.",
5
5
  "keywords": [
6
6
  "pi-package",