Skip to content

Commit

Permalink
Disallow dragging the wrong sides of the border
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Dec 9, 2024
1 parent e5947a2 commit d2fe0b2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4725,7 +4725,20 @@ func (t *Terminal) Loop() error {
}

// Preview border dragging (resizing)
pborderDragging = me.Down && (pborderDragging || clicked && t.hasPreviewWindow() && t.pborder.Enclose(my, mx))
if pborderDragging {
pborderDragging = me.Down
} else if clicked && t.hasPreviewWindow() && t.pborder.Enclose(my, mx) {
switch t.activePreviewOpts.position {
case posUp:
pborderDragging = my == t.pborder.Top()+t.pborder.Height()-1
case posDown:
pborderDragging = my == t.pborder.Top()
case posLeft:
pborderDragging = mx == t.pborder.Left()+t.pborder.Width()-1
case posRight:
pborderDragging = mx == t.pborder.Left()
}
}
if pborderDragging {
previewWidth := t.pwindow.Width() + borderColumns(t.activePreviewOpts.border, t.borderWidth)
previewHeight := t.pwindow.Height() + borderLines(t.activePreviewOpts.border)
Expand Down

0 comments on commit d2fe0b2

Please sign in to comment.