diff options
author | Joe <rbo@gmx.us> | 2024-02-13 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-02-13 20:20:20 +0100 |
commit | 299cc7237f775f4972199647c8319f90d1963e8f (patch) | |
tree | 0ce6730ae0ba392f52f149c608077cfce902ab57 /src/i_events.go | |
parent | go (diff) | |
download | hardflip-299cc7237f775f4972199647c8319f90d1963e8f.tar.gz hardflip-299cc7237f775f4972199647c8319f90d1963e8f.tar.bz2 hardflip-299cc7237f775f4972199647c8319f90d1963e8f.tar.xz hardflip-299cc7237f775f4972199647c8319f90d1963e8f.tar.zst hardflip-299cc7237f775f4972199647c8319f90d1963e8f.zip |
tmp
Diffstat (limited to 'src/i_events.go')
-rw-r--r-- | src/i_events.go | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/i_events.go b/src/i_events.go index 48db64c..4a82404 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -53,6 +53,7 @@ package main import ( "os" + "fmt" "github.com/gdamore/tcell/v2" "golang.org/x/term" @@ -352,18 +353,10 @@ func i_events(data *HardData) { os.Exit(0) } if len(data.opts.GPG) == 0 { - if len(data.ui.buff) > 0 && - (event.Key() == tcell.KeyBackspace || - event.Key() == tcell.KeyBackspace2) { - data.ui.buff = data.ui.buff[:len(data.ui.buff) - 1] - } else if event.Key() == tcell.KeyCtrlU { - data.ui.buff = "" - } else if event.Key() == tcell.KeyEnter { - data.opts.GPG = data.ui.buff - data.ui.buff = "" - data.ui.s.HideCursor() - } else if event.Rune() >= 32 && event.Rune() <= 126 { - data.ui.buff += string(event.Rune()) + if event.Rune() < '1' || event.Rune() > '9' { + break + } else { + data.opts.GPG = data.keys[event.Rune() - 48 - 1][0] } } else { // TODO: confirm @@ -372,3 +365,18 @@ func i_events(data *HardData) { } } + +// readline type beat +// if len(data.ui.buff) > 0 && +// (event.Key() == tcell.KeyBackspace || +// event.Key() == tcell.KeyBackspace2) { +// data.ui.buff = data.ui.buff[:len(data.ui.buff) - 1] +// } else if event.Key() == tcell.KeyCtrlU { +// data.ui.buff = "" +// } else if event.Key() == tcell.KeyEnter { +// data.opts.GPG = data.ui.buff +// data.ui.buff = "" +// data.ui.s.HideCursor() +// } else if event.Rune() >= 32 && event.Rune() <= 126 { +// data.ui.buff += string(event.Rune()) +// } |