DEV Community

Cover image for peektea past the roadmap ๐Ÿ‘€ sorting and scrollable previews
Athreya aka Maneshwar
Athreya aka Maneshwar

Posted on • Edited on

peektea past the roadmap ๐Ÿ‘€ sorting and scrollable previews

Hello, I'm Maneshwar. I'm building git-lrc, a Micro AI code reviewer that runs on every commit. It is free and source-available on Github. Star git-lrc to help devs discover the project. Do give it a try and share your feedback.


Last time I said the list was empty.

That was true.

Then I kept going anyway.

Press s and the list sorts by size. Press it again, newest-modified first.

Previwing something? Press [ and ] and scroll through the preview without leaving the peektea cli.

peektea sort and preview-scroll demo

Sort

The s key cycles through three modes: name โ†’ size โ†’ modified โ†’ name.

The current mode is always visible in the hint bar: s:sorted by name, s:sorted by size, s:sorted by modified.

Under the hood it's a single sort.SliceStable call inside withFilters().

The sort runs on the filtered slice, so it composes with the text filter and the hidden file toggle, same composable approach as before:

sort.SliceStable(filtered, func(i, j int) bool {
    switch m.sortMode {
    case sortSize:
        ii, _ := filtered[i].Info()
        jj, _ := filtered[j].Info()
        return ii.Size() > jj.Size() // largest first
    case sortMod:
        ii, _ := filtered[i].Info()
        jj, _ := filtered[j].Info()
        return ii.ModTime().After(jj.ModTime()) // newest first
    default:
        return strings.ToLower(filtered[i].Name()) < strings.ToLower(filtered[j].Name())
    }
})
Enter fullscreen mode Exit fullscreen mode

SliceStable preserves the relative order of entries that compare equal, which keeps directories grouped sensibly when names or sizes match.

Preview scroll

The preview panel used to show the first N lines of a file and stop there.

Now you can scroll through it with [ (up) and ] (down). Each press moves a quarter of the panel height.

The key insight: instead of limiting what gets loaded to the visible height, the preview now loads up to 500 lines and stores the whole thing.

The rendering step slices out the visible window:

lines := strings.Split(m.previewContent, "\n")
scroll := m.previewScroll
maxScroll := len(lines) - ph
if maxScroll < 0 {
    maxScroll = 0
}
if scroll > maxScroll {
    scroll = maxScroll
}
visible := lines[scroll:]
if len(visible) > ph {
    visible = visible[:ph]
}
body = strings.Join(visible, "\n")
Enter fullscreen mode Exit fullscreen mode

previewScroll resets to zero whenever you move to a new file, so you always start at the top.

Syntax highlighting via bat

While reworking the preview loading, I added a bat check.

bat is a cat clone with syntax highlighting. If it's installed, peektea uses it for text previews:

if _, err := exec.LookPath("bat"); err == nil {
    out, err := exec.Command("bat",
        "--color=always",
        "--style=plain",
        "--line-range", ":500",
        "--terminal-width", fmt.Sprintf("%d", width),
        path,
    ).Output()
    if err == nil {
        return strings.TrimRight(string(out), "\n")
    }
}
// fallback to plain text reader
Enter fullscreen mode Exit fullscreen mode

Same graceful-fallback pattern as chafa. Not installed? Plain text. Installed but fails on a particular file? Plain text. The preview never breaks.

Scrollbars

Both panels now have scrollbars.

When the preview has more content than fits on screen, a thin โ”‚ track with a โ”ƒ thumb appears on the right edge of the preview.

Same thing in the file list when there are more entries than the terminal can show.

A single function handles both:

func buildScrollbar(total, visible, scroll int) []string {
    chars := make([]string, visible)
    track := scrollTrackStyle.Render("โ”‚")
    thumb := scrollThumbStyle.Render("โ”ƒ")
    if total <= visible {
        for i := range chars {
            chars[i] = track
        }
        return chars
    }
    thumbSize := visible * visible / total
    if thumbSize < 1 {
        thumbSize = 1
    }
    thumbPos := scroll * (visible - thumbSize) / (total - visible)
    for i := range chars {
        if i >= thumbPos && i < thumbPos+thumbSize {
            chars[i] = thumb
        } else {
            chars[i] = track
        }
    }
    return chars
}
Enter fullscreen mode Exit fullscreen mode

It returns a slice of styled characters, one per visible row that get appended to each rendered line.

The thumb size scales proportionally: if half the content is visible, the thumb fills half the track.

GitHub logo lovestaco / peektea

Peek First. Open Later. A TUI file browser built with bubble tea

cover

A minimal terminal file browser built with Bubble Tea.

Peek through your filesystem with arrow keys (or vim keys), then pour each file straight into the app you've configured for it.

Demo

A quick peek before you steep:

demo

Install

One-liner:

curl -fsSL https://raw.githubusercontent.com/lovestaco/peektea/master/scripts/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Download a binary (no Go required) โ€” grab the latest release for your platform from the releases page:


























Platform File
Linux x86-64 peektea_linux_amd64.tar.gz
Linux arm64 peektealinux_arm64.tar.gz
macOS x86-64 peekteadarwin_amd64.tar.gz
macOS Apple Silicon peektea_darwin_arm64.tar.gz

Extract and put the peektea binary anywhere on your $PATH.

Install with Go:

go install github.com/lovestaco/peektea@latest
Enter fullscreen mode Exit fullscreen mode

Build from source:

git clone https://github.com/lovestaco/peektea
cd peektea
make install
Enter fullscreen mode Exit fullscreen mode

make install puts the binary in ~/go/bin and figures out $PATH for you:

  1. Already reachable โ€” done, nothing to do.
  2. ~/.local/bin is on your PATH โ€” symlinks the binary there, works immediately in the current shell.
  3. Neither โ€” appends ~/go/bin to your .bashrcโ€ฆ

AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs โ€” without telling you. You often find out in production.

git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.

Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.

โญ Star it on GitHub:

GitHub logo HexmosTech / git-lrc

Free, Micro AI Code Reviews That Run on Commit




AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.

git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.

See It In Action

See git-lrc catch serious security issues such as leaked credentials, expensive cloud operations, and sensitive material in log statements

git-lrc-intro-60s.mp4

Why

  • ๐Ÿค– AI agents silently break things. Code removed. Logic changed. Edge cases gone. You won't notice until production.
  • ๐Ÿ” Catch it before it ships. AI-powered inline comments show you exactly what changed and what looks wrong.
  • โ€ฆ

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.