Skip to content

Commit

Permalink
fixed a bug on list of very long file names
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Handa committed Sep 16, 2020
1 parent e7baa8c commit 3548235
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ctw/ctw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3548235

Please sign in to comment.