util

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorBanner

func ErrorBanner(err error, width int) string

func Height

func Height(str string) int

similar to lipgloss.Height, except returns 0 instead of 1 on empty strings

func IsImageMIME

func IsImageMIME(mime string) bool

IsImageMIME reports whether the MIME type is an image type supported by LLM APIs.

func OpenDataBackground

func OpenDataBackground(data []byte, mimeType string) error

OpenDataBackground writes data to a temporary file derived from mimeType and opens it with the system viewer in a background goroutine. The temp file is cleaned up when the viewer exits.

func OpenTempfileEditor

func OpenTempfileEditor(pattern string, content string, placeholder string) tea.Cmd

OpenTempfileEditor opens $EDITOR on a temporary file with the given content. Upon closing, the contents of the file are read and returned wrapped in a MsgTempfileEditorClosed

func ScrollIntoView

func ScrollIntoView(vp *viewport.Model, offset int, edge int)

func SystemOpener

func SystemOpener() string

SystemOpener returns the system command used to open files (xdg-open on Linux/BSD, open on macOS).

func TruncateLeftToCellWidth

func TruncateLeftToCellWidth(str string, width int, tail string) string

func TruncateRightToCellWidth

func TruncateRightToCellWidth(str string, width int, tail string) string

func Width

func Width(str string) int

Types

type MsgTempfileEditorClosed

type MsgTempfileEditorClosed string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL