feat: change input mode

readline-upstream
sammyette 2023-01-17 18:46:12 -04:00
parent f053bb2c8a
commit 2efc82736c
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
4 changed files with 9 additions and 3 deletions

View File

@ -22,3 +22,5 @@ bait.catch('hilbish.vimMode', function(mode)
ansikit.cursorStyle(ansikit.lineCursor) ansikit.cursorStyle(ansikit.lineCursor)
end end
end) end)
hilbish.inputMode 'vim'

4
api.go
View File

@ -579,10 +579,10 @@ func hlinputMode(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
switch mode { switch mode {
case "emacs": case "emacs":
unsetVimMode() unsetVimMode()
lr.rl.Config.InputMode = readline.Emacs lr.rl.Config().InputMode = readline.Emacs
case "vim": case "vim":
setVimMode("insert") setVimMode("insert")
lr.rl.Config.InputMode = readline.Vim lr.rl.Config().InputMode = readline.Vim
default: default:
return nil, errors.New("inputMode: expected vim or emacs, received " + mode) return nil, errors.New("inputMode: expected vim or emacs, received " + mode)
} }

2
go.mod
View File

@ -32,4 +32,4 @@ replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.10
replace github.com/arnodel/golua => github.com/Rosettea/golua v0.0.0-20221213193027-cbf6d4e4d345 replace github.com/arnodel/golua => github.com/Rosettea/golua v0.0.0-20221213193027-cbf6d4e4d345
replace github.com/reeflective/readline => github.com/Rosettea/rl v0.0.0-20230109220413-32e3c6f4baaa replace github.com/reeflective/readline => github.com/Rosettea/rl v0.0.0-20230114144324-1e2af14177c3

4
go.sum
View File

@ -8,6 +8,10 @@ github.com/Rosettea/golua v0.0.0-20221213193027-cbf6d4e4d345 h1:QNYjYDogUSiNUkff
github.com/Rosettea/golua v0.0.0-20221213193027-cbf6d4e4d345/go.mod h1:9jzpYPiU2is0HVGCiuIOBSXdergHUW44IEjmuN1UrIE= github.com/Rosettea/golua v0.0.0-20221213193027-cbf6d4e4d345/go.mod h1:9jzpYPiU2is0HVGCiuIOBSXdergHUW44IEjmuN1UrIE=
github.com/Rosettea/rl v0.0.0-20230109220413-32e3c6f4baaa h1:48kPGi0HKC+iGwxwXLi6HeqeGj14zm5XYeyyD8VvFOo= github.com/Rosettea/rl v0.0.0-20230109220413-32e3c6f4baaa h1:48kPGi0HKC+iGwxwXLi6HeqeGj14zm5XYeyyD8VvFOo=
github.com/Rosettea/rl v0.0.0-20230109220413-32e3c6f4baaa/go.mod h1:zSJq1ZyoiM0vGRBaF0uan1jbnoF+6M2hgZnQDtV3MX4= github.com/Rosettea/rl v0.0.0-20230109220413-32e3c6f4baaa/go.mod h1:zSJq1ZyoiM0vGRBaF0uan1jbnoF+6M2hgZnQDtV3MX4=
github.com/Rosettea/rl v0.0.0-20230114143626-6d535800e169 h1:jZKZxe6vBREgxrwdNMDPLBKVoQ369limZHwa5IebkK0=
github.com/Rosettea/rl v0.0.0-20230114143626-6d535800e169/go.mod h1:zSJq1ZyoiM0vGRBaF0uan1jbnoF+6M2hgZnQDtV3MX4=
github.com/Rosettea/rl v0.0.0-20230114144324-1e2af14177c3 h1:x3HhEGTYWM18OXn2oRlVGDCxm4noSgfIQYDfqV3E/4M=
github.com/Rosettea/rl v0.0.0-20230114144324-1e2af14177c3/go.mod h1:zSJq1ZyoiM0vGRBaF0uan1jbnoF+6M2hgZnQDtV3MX4=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e h1:P2XupP8SaylWaudD1DqbWtZ3mIa8OsE9635LmR+Q+lg= github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e h1:P2XupP8SaylWaudD1DqbWtZ3mIa8OsE9635LmR+Q+lg=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e/go.mod h1:R09vh/04ILvP2Gj8/Z9Jd0Dh0ZIvaucowMEs6abQpWs= github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e/go.mod h1:R09vh/04ILvP2Gj8/Z9Jd0Dh0ZIvaucowMEs6abQpWs=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220524215627-dfd9a4fa219b h1:s5eDMhBk6H1BgipgLub/gv9qeyBaTuiHM0k3h2/9TSE= github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220524215627-dfd9a4fa219b h1:s5eDMhBk6H1BgipgLub/gv9qeyBaTuiHM0k3h2/9TSE=