Skip to content

Commit

Permalink
Avoid redrawing the windows on the first click on the border
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Dec 10, 2024
1 parent d6c7978 commit b10f020
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4745,26 +4745,30 @@ func (t *Terminal) Loop() error {

if pborderDragging {
var newSize int
var prevSize int
switch t.activePreviewOpts.position {
case posLeft:
diff := t.pborder.Width() - t.pwindow.Width()
prevSize = t.pwindow.Width()
diff := t.pborder.Width() - prevSize
newSize = mx - t.pborder.Left() - diff + 1
case posUp:
diff := t.pborder.Height() - t.pwindow.Height()
prevSize = t.pwindow.Height()
diff := t.pborder.Height() - prevSize
newSize = my - t.pborder.Top() - diff + 1
case posDown:
prevSize = t.pwindow.Height()
offset := my - t.pborder.Top()
newSize = t.pwindow.Height() - offset
newSize = prevSize - offset
case posRight:
prevSize = t.pwindow.Width()
offset := mx - t.pborder.Left()
newSize = t.pwindow.Width() - offset
newSize = prevSize - offset
}
if newSize < 1 {
newSize = 1
}

// Don't update if the size did not change (e.g. off-axis movement)
if !t.activePreviewOpts.size.percent && t.activePreviewOpts.size.size == float64(newSize) {
if prevSize == newSize {
break
}

Expand Down

0 comments on commit b10f020

Please sign in to comment.