class

FFF::PreviewPanel

Inherits Reference < Object

PreviewPanel — Side panel showing directory contents or file preview. Activated via FFF_PREVIEW=1 env or config.json "preview": true. Minimum terminal width: 80 columns. Below that, preview is hidden.

Constants

MAX_PANEL_W = 50
MIN_WIDTH = 80
PANEL_RATIO = 0.4
TEXT_FILE_EXTENSIONS = {".txt", ".cr", ".sh", ".py", ".js", ".ts", ".json", ".yaml", ".yml", ".md", ".html", ".css", ".xml", ".rb", ".go", ".rs", ".c", ".h", ".cpp", ".hpp", ".java", ".php", ".swift", ".kt", ".toml", ".env", ".log", ".csv", ".sql", ".lua", ".ex", ".exs"}

Constructors

new(preview_width_config : String | Nil = nil)
Source

Instance methods

active?(term_width : Int32) : Bool

Check if preview should be active

Source
draw(term_width : Int32, term_height : Int32, path : String | Nil, theme : Theme, start_row : Int32, end_row : Int32)

Draw the preview panel

Source
entries_for(path : String) : Array(String)

Get preview entries for a path (cached)

Source
list_width(term_width : Int32) : Int32

Calculate left panel (file list) width

Source
panel_width(term_width : Int32) : Int32

Calculate panel width. Returns 0 if terminal is too narrow. Supports preview_width config: "40%" (ratio), "30" (absolute cols), nil (default 40% capped at 50) Cap applies to default only — explicit user config is respected as-is.

Source
read_file_lines(path : String, max_lines : Int32) : Array(String)
Source