parent
4f5b4e6dbf
commit
b40ebdcb33
4
eval.go
4
eval.go
@ -1012,8 +1012,8 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("pushing keys", e.args[0])
|
log.Println("pushing keys", e.args[0])
|
||||||
for _, key := range splitKeys(e.args[0]) {
|
for _, val := range splitKeys(e.args[0]) {
|
||||||
app.ui.keyChan <- key
|
app.ui.keyChan <- val
|
||||||
}
|
}
|
||||||
case "cmd-insert":
|
case "cmd-insert":
|
||||||
if len(e.args) == 0 {
|
if len(e.args) == 0 {
|
||||||
|
27
ui.go
27
ui.go
@ -808,34 +808,35 @@ func listMarks(marks map[string]string) *bytes.Buffer {
|
|||||||
|
|
||||||
func (ui *ui) pollEvent() tcell.Event {
|
func (ui *ui) pollEvent() tcell.Event {
|
||||||
select {
|
select {
|
||||||
case key := <-ui.keyChan:
|
case val := <-ui.keyChan:
|
||||||
var ch rune
|
var ch rune
|
||||||
var mod tcell.ModMask
|
var mod tcell.ModMask
|
||||||
var Key tcell.Key
|
|
||||||
|
|
||||||
if utf8.RuneCountInString(key) == 1 {
|
k := tcell.KeyRune
|
||||||
ch, _ = utf8.DecodeRuneInString(key)
|
|
||||||
|
if utf8.RuneCountInString(val) == 1 {
|
||||||
|
ch, _ = utf8.DecodeRuneInString(val)
|
||||||
} else {
|
} else {
|
||||||
switch {
|
switch {
|
||||||
case key == "<lt>":
|
case val == "<lt>":
|
||||||
ch = '<'
|
ch = '<'
|
||||||
case key == "<gt>":
|
case val == "<gt>":
|
||||||
ch = '>'
|
ch = '>'
|
||||||
case reAltKey.MatchString(key):
|
case reAltKey.MatchString(val):
|
||||||
match := reAltKey.FindStringSubmatch(key)[1]
|
match := reAltKey.FindStringSubmatch(val)[1]
|
||||||
ch, _ = utf8.DecodeRuneInString(match)
|
ch, _ = utf8.DecodeRuneInString(match)
|
||||||
mod = tcell.ModMask(tcell.ModAlt)
|
mod = tcell.ModMask(tcell.ModAlt)
|
||||||
default:
|
default:
|
||||||
if val, ok := gValKey[key]; ok {
|
if key, ok := gValKey[val]; ok {
|
||||||
Key = val
|
k = key
|
||||||
} else {
|
} else {
|
||||||
Key = tcell.KeyESC
|
k = tcell.KeyESC
|
||||||
ui.echoerrf("unknown key: %s", key)
|
ui.echoerrf("unknown key: %s", val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tcell.NewEventKey(Key, ch, mod)
|
return tcell.NewEventKey(k, ch, mod)
|
||||||
case ev := <-ui.evChan:
|
case ev := <-ui.evChan:
|
||||||
return ev
|
return ev
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user