mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-21 22:54:45 +00:00
Copy to primary clipboard on mouse selection
This commit is contained in:
parent
d9b8a04841
commit
89c34ed8b3
1 changed files with 6 additions and 0 deletions
|
|
@ -1,11 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/zyedidia/clipboard"
|
||||
"github.com/zyedidia/tcell"
|
||||
)
|
||||
|
||||
|
|
@ -446,6 +448,10 @@ func (v *View) HandleEvent(event tcell.Event) {
|
|||
if !v.doubleClick && !v.tripleClick {
|
||||
v.MoveToMouseClick(x, y)
|
||||
v.Cursor.CurSelection[1] = v.Cursor.Loc
|
||||
|
||||
if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
|
||||
clipboard.WriteAll(v.Cursor.GetSelection(), "primary")
|
||||
}
|
||||
}
|
||||
v.mouseReleased = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue