]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/micro.go
Fix replace cursor relocation
[micro.git] / cmd / micro / micro.go
index 2161f0dcd5d204a725671fcdb4bb8317d4dcf2ab..69ac08278df51d6cc8dff4257086c137ea08e510 100644 (file)
@@ -7,6 +7,7 @@ import (
        "os"
        "runtime"
 
+       "github.com/atotto/clipboard"
        "github.com/go-errors/errors"
        "github.com/layeh/gopher-luar"
        "github.com/mattn/go-isatty"
@@ -247,6 +248,7 @@ func main() {
        L.SetGlobal("BindKey", luar.New(L, BindKey))
        L.SetGlobal("MakeCommand", luar.New(L, MakeCommand))
        L.SetGlobal("CurView", luar.New(L, CurView))
+       L.SetGlobal("IsWordChar", luar.New(L, IsWordChar))
 
        L.SetGlobal("JobStart", luar.New(L, JobStart))
        L.SetGlobal("JobSend", luar.New(L, JobSend))
@@ -275,6 +277,18 @@ func main() {
                case event = <-events:
                }
 
+               switch e := event.(type) {
+               case *tcell.EventMouse:
+                       if e.Buttons() == tcell.Button1 {
+                               _, h := screen.Size()
+                               _, y := e.Position()
+                               if y == h-1 && messenger.message != "" {
+                                       clipboard.WriteAll(messenger.message)
+                                       continue
+                               }
+                       }
+               }
+
                if TabbarHandleMouseEvent(event) {
                        continue
                }