perf(core): use columnEdges in scrollBy
- commit
- faf772d6743d941534718c3436827be740650fb3
- author
- brice · · 2026-10-21 08:21 UTC
- parent
- 02f068b
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +6 -5
M internal/core/drag.go +6 -5
| @@ -559,20 +559,21 @@ func (c *Core) edgeScroll(t time.Duration) bool { | |||
| 559 | 559 | func (w *Workspace) scrollBy(dir int) bool { | |
| 560 | 560 | g := w.gap() | |
| 561 | 561 | n := len(w.Columns) | |
| 562 | - | maxView := max(w.columnX(n-1)+w.columnWidth(n-1)+g-(w.Usable.X+w.Usable.W), 0) | |
| 562 | + | xs, ws := w.columnEdges() | |
| 563 | + | maxView := max(xs[n-1]+ws[n-1]+g-(w.Usable.X+w.Usable.W), 0) | |
| 563 | 564 | view := w.View | |
| 564 | 565 | if dir < 0 { | |
| 565 | 566 | // The first column not fully on screen at the left. | |
| 566 | 567 | for i := n - 1; i >= 0; i-- { | |
| 567 | - | if w.columnX(i)-view < w.Usable.X+g { | |
| 568 | - | view = w.columnX(i) - w.Usable.X - g | |
| 568 | + | if xs[i]-view < w.Usable.X+g { | |
| 569 | + | view = xs[i] - w.Usable.X - g | |
| 569 | 570 | break | |
| 570 | 571 | } | |
| 571 | 572 | } | |
| 572 | 573 | } else { | |
| 573 | 574 | for i := range n { | |
| 574 | - | if w.columnX(i)+w.columnWidth(i)-view > w.Usable.X+w.Usable.W-g { | |
| 575 | - | view = w.columnX(i) + w.columnWidth(i) + g - w.Usable.X - w.Usable.W | |
| 575 | + | if xs[i]+ws[i]-view > w.Usable.X+w.Usable.W-g { | |
| 576 | + | view = xs[i] + ws[i] + g - w.Usable.X - w.Usable.W | |
| 576 | 577 | break | |
| 577 | 578 | } | |
| 578 | 579 | } | |
| @@ -559,20 +559,21 @@ func (c *Core) edgeScroll(t time.Duration) bool { | |||||
| 559 | func (w *Workspace) scrollBy(dir int) bool { | 559 | func (w *Workspace) scrollBy(dir int) bool { | ||
| 560 | g := w.gap() | 560 | g := w.gap() | ||
| 561 | n := len(w.Columns) | 561 | n := len(w.Columns) | ||
| 562 | - | maxView := max(w.columnX(n-1)+w.columnWidth(n-1)+g-(w.Usable.X+w.Usable.W), 0) | 562 | + | xs, ws := w.columnEdges() |
| 563 | + | maxView := max(xs[n-1]+ws[n-1]+g-(w.Usable.X+w.Usable.W), 0) | |||
| 563 | view := w.View | 564 | view := w.View | ||
| 564 | if dir < 0 { | 565 | if dir < 0 { | ||
| 565 | // The first column not fully on screen at the left. | 566 | // The first column not fully on screen at the left. | ||
| 566 | for i := n - 1; i >= 0; i-- { | 567 | for i := n - 1; i >= 0; i-- { | ||
| 567 | - | if w.columnX(i)-view < w.Usable.X+g { | 568 | + | if xs[i]-view < w.Usable.X+g { |
| 568 | - | view = w.columnX(i) - w.Usable.X - g | 569 | + | view = xs[i] - w.Usable.X - g |
| 569 | break | 570 | break | ||
| 570 | } | 571 | } | ||
| 571 | } | 572 | } | ||
| 572 | } else { | 573 | } else { | ||
| 573 | for i := range n { | 574 | for i := range n { | ||
| 574 | - | if w.columnX(i)+w.columnWidth(i)-view > w.Usable.X+w.Usable.W-g { | 575 | + | if xs[i]+ws[i]-view > w.Usable.X+w.Usable.W-g { |
| 575 | - | view = w.columnX(i) + w.columnWidth(i) + g - w.Usable.X - w.Usable.W | 576 | + | view = xs[i] + ws[i] + g - w.Usable.X - w.Usable.W |
| 576 | break | 577 | break | ||
| 577 | } | 578 | } | ||
| 578 | } | 579 | } | ||