]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/view.go
Copy to primary clipboard for any change in selection
[micro.git] / cmd / micro / view.go
index 95f75424dc91580d4bc778a312f8f1c2bb8faa6d..996ac8bdd39cde4e67e443c5fbc07f2f34453485 100644 (file)
@@ -414,8 +414,8 @@ func (v *View) HandleEvent(event tcell.Event) {
                                        v.lastClickTime = time.Now()
 
                                        v.Cursor.OrigSelection[0] = v.Cursor.Loc
-                                       v.Cursor.CurSelection[0] = v.Cursor.Loc
-                                       v.Cursor.CurSelection[1] = v.Cursor.Loc
+                                       v.Cursor.SetSelectionStart(v.Cursor.Loc)
+                                       v.Cursor.SetSelectionEnd(v.Cursor.Loc)
                                }
                                v.mouseReleased = false
                        } else if !v.mouseReleased {
@@ -425,7 +425,7 @@ func (v *View) HandleEvent(event tcell.Event) {
                                } else if v.doubleClick {
                                        v.Cursor.AddWordToSelection()
                                } else {
-                                       v.Cursor.CurSelection[1] = v.Cursor.Loc
+                                       v.Cursor.SetSelectionEnd(v.Cursor.Loc)
                                }
                        }
                case tcell.Button2:
@@ -445,7 +445,7 @@ func (v *View) HandleEvent(event tcell.Event) {
 
                                if !v.doubleClick && !v.tripleClick {
                                        v.MoveToMouseClick(x, y)
-                                       v.Cursor.CurSelection[1] = v.Cursor.Loc
+                                       v.Cursor.SetSelectionEnd(v.Cursor.Loc)
                                }
                                v.mouseReleased = true
                        }