mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-09 08:30:23 +09:00
Add onRune(r string) callback for plugins
Define this function in a plugin (which takes one argument) to be notified whenever a character is typed, and the character will be passed as the argument.
This commit is contained in:
@@ -298,6 +298,13 @@ func (v *View) HandleEvent(event tcell.Event) {
|
||||
}
|
||||
v.Buf.Insert(v.Cursor.Loc, string(e.Rune()))
|
||||
v.Cursor.Right()
|
||||
|
||||
for _, pl := range loadedPlugins {
|
||||
err := Call(pl+".onRune", []string{string(e.Rune())})
|
||||
if err != nil && !strings.HasPrefix(err.Error(), "function does not exist") {
|
||||
TermMessage(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for key, actions := range bindings {
|
||||
if e.Key() == key.keyCode {
|
||||
|
||||
Reference in New Issue
Block a user