From 3548235135fb85815f29ae87d2e2a5e6d10007c9 Mon Sep 17 00:00:00 2001 From: Yash-Handa Date: Wed, 16 Sep 2020 17:16:33 +0530 Subject: [PATCH] fixed a bug on list of very long file names --- ctw/ctw.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ctw/ctw.go b/ctw/ctw.go index 08a5f65..a5fc3d8 100644 --- a/ctw/ctw.go +++ b/ctw/ctw.go @@ -94,6 +94,13 @@ func (w *CTW) Flush(buf *bytes.Buffer) { totW := widthsSum(iw, pad) //total width of the ls block if totW > w.termW { + // not even first iteration done print similar to logo-ls -1 + if len(widths) == 0 { + widths = make([][4]int, len(iw)) + for i := range iw { + widths[i] = iw[i] + } + } break } else if totW >= w.termW/2 { // if total width of the ls block is more than half of terminal // copy iw to widths