mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add offset sanity check to CompactGrid Align()
This commit is contained in:
@@ -22,9 +22,14 @@ func NewCompactGrid() *CompactGrid {
|
|||||||
|
|
||||||
func (cg *CompactGrid) Align() {
|
func (cg *CompactGrid) Align() {
|
||||||
y := cg.Y
|
y := cg.Y
|
||||||
|
|
||||||
if cg.Offset >= len(cg.Rows) {
|
if cg.Offset >= len(cg.Rows) {
|
||||||
cg.Offset = 0
|
cg.Offset = 0
|
||||||
}
|
}
|
||||||
|
if cg.Offset < 0 {
|
||||||
|
cg.Offset = 0
|
||||||
|
}
|
||||||
|
|
||||||
// update row ypos, width recursively
|
// update row ypos, width recursively
|
||||||
for _, r := range cg.pageRows() {
|
for _, r := range cg.pageRows() {
|
||||||
r.SetY(y)
|
r.SetY(y)
|
||||||
|
|||||||
Reference in New Issue
Block a user