feat: file preview in interactive mode#58
Conversation
Press enter on a file to view its content with line numbers. Scroll with arrow keys, press esc/q to go back to the picker. Handles binary files, large files, and symlinks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ines - Navigate lines with up/down, current line has dark gray background - Line number width adapts to total line count - No empty padding lines when file is shorter than viewport Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…k folder jump - File size right-aligned at end of line in tree view - Preview header shows path • size format - Enter on symlink-to-folder jumps cursor to target folder and expands it Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Folder sizes calculated from sum of children. Shown right-aligned same as file sizes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| const ancestorPath = pathParts.slice(0, pi).join("/") | ||
| const ancestor = findNodeByPath(tree, ancestorPath) | ||
| if (ancestor && ancestor.type === "tree") ancestor.expanded = true | ||
| } |
There was a problem hiding this comment.
Preview mode swaps the stdin key handler, but it never swaps the global resize handler. stream.on("resize", onResize) still points at the tree renderer, so resizing the terminal while preview is open redraws the main picker even though preview-mode key handling remains active. That leaves the UI and input state out of sync until the user exits preview.
|
Review score: 7/10 The feature adds real value and the implementation is close, but I found two preview-mode issues that feel worth fixing before merge:
I left both notes inline on the relevant lines. |
| // Pad remaining | ||
| for (let i = visibleCount; i < viewportHeight; i++) { | ||
| out += "\n" | ||
| } |
There was a problem hiding this comment.
For symlink previews this path is resolved from basePath instead of from the symlink's parent directory. A relative link like docs/readme.md -> ../README.md will preview basePath/../README.md instead of resolving from docs/, so the wrong file gets opened or the preview falls back to unable to read file. This should use the same resolveSymlinkPath() helper used elsewhere before joining with basePath.
Summary
Test plan
gitpick nrjdalal/picksuite -i -b main- preview files with entersymdir -> folder/- jumps to folder🤖 Generated with Claude Code