Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Fix column spacing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Apr 22, 2018
1 parent ba84728 commit 8505b9c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/cjbassi/termui/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 15 additions & 19 deletions vendor/github.com/cjbassi/termui/colors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 17 additions & 13 deletions vendor/github.com/cjbassi/termui/table.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 1 addition & 14 deletions widgets/proc.go
Expand Up @@ -8,22 +8,15 @@ import (
"time"

ui "github.com/cjbassi/termui"
"github.com/mattn/go-runewidth"
psCPU "github.com/shirou/gopsutil/cpu"
psProc "github.com/shirou/gopsutil/process"
)

var arrowWidth int

const (
UP = "▲"
DOWN = "▼"
)

func init() {
arrowWidth = runewidth.StringWidth(UP)
}

// Process represents each process.
type Process struct {
PID int32
Expand Down Expand Up @@ -137,13 +130,7 @@ func (self *Proc) Sort() {
func (self *Proc) ColResize() {
copy(self.ColWidths, self.DefaultColWidths)

// calculate gap size based on total width
self.Gap = 3
if self.X < 50 {
self.Gap = 1
} else if self.X < 75 {
self.Gap = 2
}

self.CellXPos = []int{
self.Gap,
Expand All @@ -163,7 +150,7 @@ func (self *Proc) ColResize() {
self.ColWidths[2] = 0
self.ColWidths[3] = 0
} else if self.X < rowWidth {
self.CellXPos[2] = self.CellXPos[3] - 1
self.CellXPos[2] = self.CellXPos[3]
self.ColWidths[3] = 0
}
}
Expand Down

0 comments on commit 8505b9c

Please sign in to comment.