@vinh0809it/claude-sessions 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.
Files changed (2) hide show
  1. package/index.js +8 -27
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -872,23 +872,6 @@ class Picker {
872
872
  }
873
873
  }
874
874
 
875
- // Word-wraps text to `width` columns; words longer than a line are split.
876
- function wrapWords(text, width) {
877
- const lines = [];
878
- let cur = '';
879
- for (let word of text.split(' ')) {
880
- while (word.length > width) {
881
- if (cur) { lines.push(cur); cur = ''; }
882
- lines.push(word.slice(0, width)); word = word.slice(width);
883
- }
884
- if (!cur) cur = word;
885
- else if (cur.length + 1 + word.length <= width) cur += ' ' + word;
886
- else { lines.push(cur); cur = word; }
887
- }
888
- if (cur || !lines.length) lines.push(cur);
889
- return lines;
890
- }
891
-
892
875
  // A stdin chunk may hold several keys (fast typing, paste): split into single
893
876
  // chars, keeping escape sequences like "\x1b[A" or "\x1b[5~" whole.
894
877
  function splitKeys(chunk) {
@@ -1123,16 +1106,14 @@ class TUI {
1123
1106
  const key = s.jsonlPath + ':' + s.lastModified.valueOf();
1124
1107
  let msgs = this._previewCache.get(key);
1125
1108
  if (!msgs) { msgs = readRecentMessages(s.jsonlPath); this._previewCache.set(key, msgs); }
1126
- const lines = [];
1127
- for (const m of msgs) {
1128
- const tag = m.role === 'user' ? fgc('92', 'you ') : fgc('96', 'cc ');
1129
- const width = Math.max(10, W - 8);
1130
- const chunks = wrapWords(m.text, width);
1131
- chunks.slice(0, 3).forEach((c, i) => lines.push(` ${i === 0 ? tag : ' '} ${i === 2 && chunks.length > 3 ? trunc(c, width - 1) + '…' : c}`));
1132
- }
1133
- if (!lines.length) lines.push(dim(' (no messages)'));
1109
+ // One line per message with a blank line between, newest at the bottom.
1110
+ const width = Math.max(10, W - 8);
1111
+ const lines = msgs.flatMap(m => ['',
1112
+ ` ${m.role === 'user' ? fgc('92', 'you ') : fgc('96', 'cc ')} ${trunc(m.text.replace(/\s+/g, ' ').trim(), width)}`]);
1113
+ const body = lines.slice(-(H - 2));
1114
+ if (body[0] === '') body.shift();
1134
1115
  const head = dim(` ${fmtDate(s.lastModified)} · ${fmtSize(s.size)} · ${s.sessionId}`);
1135
- return [head, ...lines.slice(-(H - 1))];
1116
+ return [head, '', ...(body.length ? body : [dim(' (no messages)')])];
1136
1117
  }
1137
1118
 
1138
1119
  // ── Render ──────────────────────────────────────────────────────────────────
@@ -1425,6 +1406,6 @@ if (require.main === module) {
1425
1406
  module.exports = {
1426
1407
  encodePathToDir, projectDirNameFor, tabComplete, resolveProjectPath, moveSession, readSession,
1427
1408
  readRecentMessages, renameSession, deleteSessionFiles, emptyTrash, scanConfigDir, sortSessions,
1428
- detectTerminal, wtArgs, parseArgs, fmtAgo, fmtSize, splitKeys, wrapWords, cache, LineInput,
1409
+ detectTerminal, wtArgs, parseArgs, fmtAgo, fmtSize, splitKeys, cache, LineInput,
1429
1410
  };
1430
1411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinh0809it/claude-sessions",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Fast terminal UI for browsing, previewing, resuming, renaming, moving, and deleting Claude Code sessions",
5
5
  "bin": {
6
6
  "claude-sessions": "index.js"