Text Preview
By the end of this guide, you will:
-
Build a third Fragment for the preview pane
-
Read file contents using Ruby’s File API
-
Detect whether a file is text or binary
⚠️ This page is a stub. Help us write it! See the Documentation Plan and Style Guide.
User Stories
Story 6: Text File Preview
As a terminal user
I want to see a preview of text files in the preview pane
So that I can verify file contents before opening
Acceptance Criteria
-
When text file is selected, preview pane shows first ~20 lines
-
Preview updates as selection changes
-
Binary files show “Binary file” message
-
Preview pane scrolls if content is long
-
File type is detected (text vs binary)
Notes
-
Introduces file reading
-
Introduces text detection
-
Introduces preview scrolling
-
Limit to first 1000 lines for performance