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
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user