Compare commits

...

4 Commits

Author SHA1 Message Date
TorchedSammy ded0be275f
chore: bump version to v2.0.0 2022-04-13 20:50:29 -04:00
TorchedSammy e3fdf84f5c
fix!: make path to script the 0th arg instead of 1st
makes more sense, brings some lua parity
this means that user passed args start from 1
instead of 2
2022-04-13 20:19:28 -04:00
TorchedSammy 194e4e01b7
fix: don't insert any unhandled control keys 2022-04-13 19:36:18 -04:00
TorchedSammy e5c9b85008
feat: add ctrl _ to undo 2022-04-13 16:58:36 -04:00
4 changed files with 8 additions and 5 deletions

View File

@ -155,7 +155,7 @@ func main() {
if getopt.NArgs() > 0 {
luaArgs := rt.NewTable()
for i, arg := range getopt.Args() {
luaArgs.Set(rt.IntValue(int64(i + 1)), rt.StringValue(arg))
luaArgs.Set(rt.IntValue(int64(i)), rt.StringValue(arg))
}
l.GlobalEnv().Set(rt.StringValue("args"), rt.TableValue(luaArgs))

View File

@ -34,7 +34,6 @@ const (
charCtrlHat // ^^
charCtrlUnderscore // ^_
charBackspace2 = 127 // ASCII 1963
)
// Escape sequences

View File

@ -416,6 +416,10 @@ func (rl *Instance) Readline() (string, error) {
rl.renderHelpers()
}
case charCtrlUnderscore:
rl.undoLast()
rl.viUndoSkipAppend = true
case '\r':
fallthrough
case '\n':
@ -553,8 +557,8 @@ func (rl *Instance) editorInput(r []rune) {
rl.refreshVimStatus()
default:
// For some reason Ctrl+k messes with the input line, so ignore it.
if r[0] == 11 {
// Don't insert control keys
if r[0] >= 1 && r[0] <= 31 {
return
}
// We reset the history nav counter each time we come here:

View File

@ -2,7 +2,7 @@ package main
// String vars that are free to be changed at compile time
var (
version = "v1.2.0"
version = "v2.0.0"
defaultConfDir = "" // ~ will be substituted for home, path for user's default config
defaultHistDir = ""
commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"