mirror of
https://github.com/VladimirMarkelov/clui.git
synced 2025-05-01 22:18:35 +08:00
closes #42 - editField clipboard support
This commit is contained in:
parent
3dc059c8b8
commit
35566a4486
8
edit.go
8
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user