From 35566a4486db2c9a8ddc3b3b0e6612dbc309f769 Mon Sep 17 00:00:00 2001 From: Vladimir Markelov Date: Tue, 24 Nov 2015 10:26:42 -0800 Subject: [PATCH] closes #42 - editField clipboard support --- edit.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/edit.go b/edit.go index 505480b..349d54f 100644 --- a/edit.go +++ b/edit.go @@ -1,6 +1,7 @@ package clui import ( + clip "github.com/atotto/clipboard" xs "github.com/huandu/xstrings" term "github.com/nsf/termbox-go" ) @@ -288,6 +289,13 @@ func (e *EditField) ProcessEvent(event Event) bool { case term.KeyArrowRight: e.charRight() return true + case term.KeyCtrlC: + clip.WriteAll(e.Title()) + return true + case term.KeyCtrlV: + s, _ := clip.ReadAll() + e.SetTitle(s) + return true default: if event.Ch != 0 { e.insertRune(event.Ch)