Skip to content

Commit

Permalink
Merge pull request #5 from anderskvist/limit_width
Browse files Browse the repository at this point in the history
Limit width to make sure lines don't wrap.
  • Loading branch information
abrander authored Nov 7, 2019
2 parents 69b6e4e + 6a45de1 commit e42dd1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ MAINLOOP:
continue MAINLOOP
}

_, height := getTerminalSize()
width, height := getTerminalSize()
delta := t.Sub(lastTime)

sort.Sort(processSort(s.Processes))
Expand Down Expand Up @@ -464,8 +464,8 @@ MAINLOOP:
fmt.Printf("\033[33m")
}

// Print the process line.
fmt.Printf("%7d %10s %10s %10d %10s %7s %s\033[K", pro.Pid, up.String(), pro.State, pro.LastRequestMemory, durStr, pro.RequestMethod, pro.RequestURI)
// Print the process line. 61 is a magic width constant :)
fmt.Printf("%7d %10s %10s %10d %10s %7s %.*s\033[K", pro.Pid, up.String(), pro.State, pro.LastRequestMemory, durStr, pro.RequestMethod, width-61, pro.RequestURI)

// Rerset ANSI colors etc.
fmt.Printf("\033[0m")
Expand Down

0 comments on commit e42dd1c

Please sign in to comment.