Change variable visibility (#3720)

Changed DoubleClick and TripleClick to public so they can be accessed by
Lua plugins.
This commit is contained in:
cutelisp 2025-04-29 19:55:01 +01:00 committed by GitHub
parent b61c8a4e1a
commit ca32ffbb4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -73,12 +73,12 @@ func (h *BufPane) MousePress(e *tcell.EventMouse) bool {
h.Cursor.Loc = mouseLoc
}
if time.Since(h.lastClickTime)/time.Millisecond < config.DoubleClickThreshold && (mouseLoc.X == h.lastLoc.X && mouseLoc.Y == h.lastLoc.Y) {
if h.doubleClick {
if h.DoubleClick {
// Triple click
h.lastClickTime = time.Now()
h.tripleClick = true
h.doubleClick = false
h.TripleClick = true
h.DoubleClick = false
h.Cursor.SelectLine()
h.Cursor.CopySelection(clipboard.PrimaryReg)
@ -86,15 +86,15 @@ func (h *BufPane) MousePress(e *tcell.EventMouse) bool {
// Double click
h.lastClickTime = time.Now()
h.doubleClick = true
h.tripleClick = false
h.DoubleClick = true
h.TripleClick = false
h.Cursor.SelectWord()
h.Cursor.CopySelection(clipboard.PrimaryReg)
}
} else {
h.doubleClick = false
h.tripleClick = false
h.DoubleClick = false
h.TripleClick = false
h.lastClickTime = time.Now()
h.Cursor.OrigSelection[0] = h.Cursor.Loc
@ -116,9 +116,9 @@ func (h *BufPane) MouseDrag(e *tcell.EventMouse) bool {
}
h.Cursor.Loc = h.LocFromVisual(buffer.Loc{mx, my})
if h.tripleClick {
if h.TripleClick {
h.Cursor.AddLineToSelection()
} else if h.doubleClick {
} else if h.DoubleClick {
h.Cursor.AddWordToSelection()
} else {
h.Cursor.SelectTo(h.Cursor.Loc)
@ -135,7 +135,7 @@ func (h *BufPane) MouseRelease(e *tcell.EventMouse) bool {
// that doesn't support mouse motion events. But when the mouse click is
// within the scroll margin, that would cause a scroll and selection
// even for a simple mouse click, which is not good.
// if !h.doubleClick && !h.tripleClick {
// if !h.DoubleClick && !h.TripleClick {
// mx, my := e.Position()
// h.Cursor.Loc = h.LocFromVisual(buffer.Loc{mx, my})
// h.Cursor.SetSelectionEnd(h.Cursor.Loc)

View File

@ -236,9 +236,9 @@ type BufPane struct {
// Was the last mouse event actually a double click?
// Useful for detecting triple clicks -- if a double click is detected
// but the last mouse event was actually a double click, it's a triple click
doubleClick bool
DoubleClick bool
// Same here, just to keep track for mouse move events
tripleClick bool
TripleClick bool
// Should the current multiple cursor selection search based on word or
// based on selection (false for selection, true for word)