Skip to content

Latest commit

 

History

History
131 lines (91 loc) · 3.94 KB

File metadata and controls

131 lines (91 loc) · 3.94 KB

bless TODO - Missing less Features

Navigation

  • F - Follow mode (like tail -f, auto-scroll as file grows)
  • r / R - Repaint/refresh screen
  • z - Forward one window (with optional count)
  • w - Backward one window
  • e - Forward one line (alias for j)
  • y - Backward one line (alias for k)

Searching

  • ? - Search backward
  • &pattern - Show only lines matching pattern (filter mode)
  • ESC-u - Toggle search highlighting

Marks

  • m + letter - Set a mark at current position
  • ' + letter - Jump to a mark
  • '' - Return to previous position before last jump

File Commands

  • :d - Remove current file from buffer list
  • :x - Go to first file in buffer list

Options (toggle with -)

  • -i - Ignore case in search
  • -I - Ignore case even when pattern has uppercase
  • -N - Toggle line numbers
  • -S - Toggle line wrap (chop long lines)

Other

  • v - Open current file in $EDITOR
  • h - Help screen (less standard, we have F1)

Command-Line Arguments

Display Options

  • -N / --LINE-NUMBERS - Show line numbers
  • -S / --chop-long-lines - Don't wrap, truncate long lines
  • -R / --RAW-CONTROL-CHARS - Interpret ANSI color escape codes
  • -X / --no-init - Don't clear screen on exit
  • -x N / --tabs=N - Set tab width

Search Options

  • -i / --ignore-case - Ignore case in searches
  • -I / --IGNORE-CASE - Ignore case even if pattern has uppercase
  • -p pattern - Start at first occurrence of pattern
  • +/pattern - Same as -p

Behavior Options

  • -F / --quit-if-one-screen - Quit if content fits on one screen
  • -e / --quit-at-eof - Quit at second EOF
  • -E / --QUIT-AT-EOF - Quit at first EOF
  • -q / --quiet / --silent - No terminal bell
  • +F - Start in follow mode
  • +G - Start at end of file

Prompt Options

  • -M / --LONG-PROMPT - Verbose prompt with line numbers/percentage
  • -m / --long-prompt - Medium verbosity prompt

Architecture: Large File Support

Currently bless reads entire files into memory (os.ReadFile), which fails for large files (100M+ lines). Need to implement lazy loading like less.

Line Index

  • Build index of byte offsets for line starts
  • Use sparse index (every Nth line) for memory efficiency
  • Enable O(log n) jumping to any line number
  • Incremental index building (don't block on startup)

Lazy Loading

  • Memory-map files instead of reading entirely
  • Load only visible lines + buffer region
  • LRU cache for recently viewed chunks
  • Re-read from disk when scrolling to new regions

Viewport-Based Rendering

  • Decouple viewport from full document storage
  • Only materialize text for visible lines
  • Handle word-wrap calculation without full content

Stdin / Pipe Handling

  • Buffer stdin to temp file for random access
  • Support seeking in piped content
  • Size limits / warnings for huge streams

Performance Targets

  • Open 1GB+ files instantly (index in background)
  • Smooth scrolling regardless of file size
  • Memory usage proportional to viewport, not file size

Priority Features

High impact features to implement first:

Keybindings

  1. Follow mode (F) - Essential for log files (DONE)
  2. Backward search (?) - Common navigation pattern
  3. Marks (m/') - Power user feature for large files
  4. Case-insensitive search toggle (-i) - Very frequently needed
  5. Filter mode (&) - Useful for log analysis

Command-Line Arguments

  1. -N - Line numbers (common use case)
  2. -S - Chop long lines (essential for wide content)
  3. -i - Case-insensitive search (very common)
  4. -F - Quit if one screen (used in scripts/pipes)
  5. +F - Start in follow mode (log file monitoring)
  6. -R - Raw ANSI codes (colored output from commands)