mirror of
https://github.com/Hopiu/micro.git
synced 2026-05-01 19:44:43 +00:00
Only register double click on equal mouse location
This commit is contained in:
parent
0a35bfe2f5
commit
1e55b6f6b3
2 changed files with 4 additions and 1 deletions
|
|
@ -78,7 +78,7 @@ func (v *View) MousePress(usePlugin bool, e *tcell.EventMouse) bool {
|
|||
v.Cursor.ResetSelection()
|
||||
v.Relocate()
|
||||
}
|
||||
if time.Since(v.lastClickTime)/time.Millisecond < doubleClickThreshold {
|
||||
if time.Since(v.lastClickTime)/time.Millisecond < doubleClickThreshold && (x == v.lastLoc.X && y == v.lastLoc.Y) {
|
||||
if v.doubleClick {
|
||||
// Triple click
|
||||
v.lastClickTime = time.Now()
|
||||
|
|
@ -119,6 +119,8 @@ func (v *View) MousePress(usePlugin bool, e *tcell.EventMouse) bool {
|
|||
}
|
||||
}
|
||||
|
||||
v.lastLoc = Loc{x, y}
|
||||
|
||||
if usePlugin {
|
||||
PostActionCall("MousePress", v, e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ type View struct {
|
|||
// This stores when the last click was
|
||||
// This is useful for detecting double and triple clicks
|
||||
lastClickTime time.Time
|
||||
lastLoc Loc
|
||||
|
||||
// lastCutTime stores when the last ctrl+k was issued.
|
||||
// It is used for clearing the clipboard to replace it with fresh cut lines.
|
||||
|
|
|
|||
Loading…
Reference in a new issue