diff --git a/cmd/cli/item.go b/cmd/cli/item.go index e781c55..58c4304 100644 --- a/cmd/cli/item.go +++ b/cmd/cli/item.go @@ -126,7 +126,7 @@ func (i item) drawItemColumns(compactRendering bool) itemColumns { } } -func (ic itemColumns) produceLine(dateLength int, locationLength int, flagLength int, showDate bool) (string, int) { +func (ic itemColumns) produceLine(dateLength int, locationLength int, flagLength int, header bool, showDate bool) (string, int) { line := "" if showDate { date := ic.date @@ -156,7 +156,7 @@ func (ic itemColumns) produceLine(dateLength int, locationLength int, flagLength flags += " " } spacer := " " - if flagLength > 5 { + if flagLength > 5 || header { // use shorter spacer // because there is likely a long flag like E130 in the view spacer = " " diff --git a/cmd/cli/main.go b/cmd/cli/main.go index a5dc44a..93b3ee4 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -453,12 +453,17 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { longestDateLen := len(header.date) longestLocationLen := len(header.host) + len(header.pwdTilde) longestFlagsLen := 2 + maxPossibleMainViewHeight := maxY - 3 - 1 - 1 - 1 // - top box - header - status - help for i, itm := range m.s.data { if i == maxY { break } ic := itm.drawItemColumns(compactRenderingMode) data = append(data, ic) + if i > maxPossibleMainViewHeight { + // do not stretch columns because of results that will end up outside of the page + continue + } if len(ic.date) > longestDateLen { longestDateLen = len(ic.date) } @@ -494,7 +499,7 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { // header // header := getHeader() - dispStr, _ := header.produceLine(longestDateLen, longestLocationLen, longestFlagsLen, true) + dispStr, _ := header.produceLine(longestDateLen, longestLocationLen, longestFlagsLen, true, true) dispStr = doHighlightHeader(dispStr, maxX*2) v.WriteString(dispStr + "\n") @@ -506,7 +511,7 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { break } - displayStr, _ := itm.produceLine(longestDateLen, longestLocationLen, longestFlagsLen, true) + displayStr, _ := itm.produceLine(longestDateLen, longestLocationLen, longestFlagsLen, false, true) if m.s.highlightedItem == index { // maxX * 2 because there are escape sequences that make it hard to tell the real string lenght displayStr = doHighlightString(displayStr, maxX*3)