mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-22 16:57:12 +09:00
Only register double click on equal mouse location
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user