Documentation tweak

This commit is contained in:
Matt Low 2024-05-30 18:22:56 +00:00
parent a6522dbcd0
commit 58e1b84fea
1 changed files with 4 additions and 7 deletions

View File

@ -14,9 +14,9 @@ import (
type MsgTempfileEditorClosed string
// OpenTempfileEditor opens an $EDITOR on a new temporary file with the given
// content. Upon closing, the contents of the file are read back returned
// wrapped in a msgTempfileEditorClosed returned by the 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 OpenTempfileEditor(pattern string, content string, placeholder string) tea.Cmd {
msgFile, _ := os.CreateTemp("/tmp", pattern)
@ -46,7 +46,7 @@ func OpenTempfileEditor(pattern string, content string, placeholder string) tea.
})
}
// similar to lipgloss.Height, except returns 0 on empty strings
// similar to lipgloss.Height, except returns 0 instead of 1 on empty strings
func Height(str string) int {
if str == "" {
return 0
@ -72,9 +72,6 @@ func TruncateToCellWidth(str string, width int, tail string) string {
return str + tail
}
// fraction is the fraction of the total screen height into view the offset
// should be scrolled into view. 0.5 = items will be snapped to middle of
// view
func ScrollIntoView(vp *viewport.Model, offset int, edge int) {
currentOffset := vp.YOffset
if offset >= currentOffset && offset < currentOffset+vp.Height {