closes #42 - editField clipboard support

This commit is contained in:
Vladimir Markelov 2015-11-24 10:26:42 -08:00
parent 3dc059c8b8
commit 35566a4486

View File

@ -1,6 +1,7 @@
package clui package clui
import ( import (
clip "github.com/atotto/clipboard"
xs "github.com/huandu/xstrings" xs "github.com/huandu/xstrings"
term "github.com/nsf/termbox-go" term "github.com/nsf/termbox-go"
) )
@ -288,6 +289,13 @@ func (e *EditField) ProcessEvent(event Event) bool {
case term.KeyArrowRight: case term.KeyArrowRight:
e.charRight() e.charRight()
return true return true
case term.KeyCtrlC:
clip.WriteAll(e.Title())
return true
case term.KeyCtrlV:
s, _ := clip.ReadAll()
e.SetTitle(s)
return true
default: default:
if event.Ch != 0 { if event.Ch != 0 {
e.insertRune(event.Ch) e.insertRune(event.Ch)