Skip to content

Commit

Permalink
Fix long filenames trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
dborzov committed Mar 18, 2016
1 parent a74cba9 commit e0e031e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ const (
)

var (
terminalWidth = 80
columnSize = 39 // characters in the filename column
maxFileNameSize = columnSize - 5
terminalWidth = 80
columnSize = 39 // characters in the filename column
)

// Defines Terminal Coloring Theme
Expand Down Expand Up @@ -82,7 +81,7 @@ func renderFiles(fls []*FileInfo) {

// PrintColumns prints two-column table row, nicely formatted and shortened if needed
func PrintColumns(filename, description string) {

maxFileNameSize := columnSize - 6
if utf8.RuneCountInString(filename) > maxFileNameSize {
filename = string([]rune(filename)[0:maxFileNameSize]) + "[META][...]"
}
Expand Down

0 comments on commit e0e031e

Please sign in to comment.