diff --git a/pkg/tui/util/util.go b/pkg/tui/util/util.go index 9691c16..1cdd974 100644 --- a/pkg/tui/util/util.go +++ b/pkg/tui/util/util.go @@ -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 {