From 8be0f9c52981bd6b1e845198ee89d7347f4c635b Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 17 Jun 2016 11:24:54 -0400 Subject: [PATCH] Clicking on messages will copy them to the clipboard Fixes #172 --- cmd/micro/micro.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 2161f0dc..9b952f63 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -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" @@ -275,6 +276,16 @@ func main() { case event = <-events: } + switch e := event.(type) { + case *tcell.EventMouse: + _, h := screen.Size() + _, y := e.Position() + if y == h-1 { + clipboard.WriteAll(messenger.message) + } + continue + } + if TabbarHandleMouseEvent(event) { continue }