Disallow dragging the wrong sides of the border

This commit is contained in:
Junegunn Choi 2024-12-09 17:54:47 +09:00
parent 6c9025ff17
commit 3fc0bd26a5

View File

@ -4722,7 +4722,18 @@ func (t *Terminal) Loop() error {
}
// Preview border dragging (resizing)
pborderDragging = me.Down && (pborderDragging || clicked && t.hasPreviewWindow() && t.pborder.Enclose(my, mx))
if !pborderDragging && 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)