mirror of https://github.com/Hilbis/Hilbish
Compare commits
4 Commits
b0e4cf6ed1
...
237bc19f68
Author | SHA1 | Date |
---|---|---|
TorchedSammy | 237bc19f68 | |
TorchedSammy | 63e33af34d | |
TorchedSammy | d7f10b0247 | |
TorchedSammy | 99461e42d0 |
3
api.go
3
api.go
|
@ -25,6 +25,7 @@ var exports = map[string]lua.LGFunction {
|
|||
"appendPath": hlappendPath,
|
||||
"cwd": hlcwd,
|
||||
"exec": hlexec,
|
||||
"goro": hlgoro,
|
||||
"multiprompt": hlmlprompt,
|
||||
"prependPath": hlprependPath,
|
||||
"prompt": hlprompt,
|
||||
|
@ -265,7 +266,7 @@ func hlexec(L *lua.LState) int {
|
|||
// goro(fn)
|
||||
// Puts `fn` in a goroutine
|
||||
// --- @param fn function
|
||||
func hlgoroutine(L *lua.LState) int {
|
||||
func hlgoro(L *lua.LState) int {
|
||||
fn := L.CheckFunction(1)
|
||||
argnum := L.GetTop()
|
||||
args := make([]lua.LValue, argnum)
|
||||
|
|
|
@ -29,7 +29,7 @@ function hilbish.exec(cmd) end
|
|||
|
||||
--- Puts `fn` in a goroutine
|
||||
--- @param fn function
|
||||
function hilbish.goroutine(fn) end
|
||||
function hilbish.goro(fn) end
|
||||
|
||||
--- Sets the input mode for Hilbish's line reader. Accepts either emacs for vim
|
||||
--- @param mode string
|
||||
|
|
2
go.mod
2
go.mod
|
@ -16,6 +16,6 @@ require (
|
|||
|
||||
replace mvdan.cc/sh/v3 => github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20211022004519-f67a49cb50f5
|
||||
|
||||
replace github.com/maxlandon/readline => github.com/Rosettea/readline-1 v0.0.0-20220302012429-9ce5d23760f7
|
||||
replace github.com/maxlandon/readline => github.com/Rosettea/readline-1 v0.0.0-20220305004552-071c22768119
|
||||
|
||||
replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.10
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,5 +1,7 @@
|
|||
github.com/Rosettea/readline-1 v0.0.0-20220302012429-9ce5d23760f7 h1:LoY+kBKqMQqBcilRpVvifBTVve84asa3btpx3D/+IvM=
|
||||
github.com/Rosettea/readline-1 v0.0.0-20220302012429-9ce5d23760f7/go.mod h1:QiUAvbhg8PzCA4hlafCUl0bKD/0VmcocM4AjqtszAJs=
|
||||
github.com/Rosettea/readline-1 v0.0.0-20220305004552-071c22768119 h1:rGsc30WTD5hk+oiXrAKsAIwZn5qBeTAdr29y3HhJh9E=
|
||||
github.com/Rosettea/readline-1 v0.0.0-20220305004552-071c22768119/go.mod h1:QiUAvbhg8PzCA4hlafCUl0bKD/0VmcocM4AjqtszAJs=
|
||||
github.com/Rosettea/readline-1 v0.1.0-beta.0.20211207003625-341c7985ad7d h1:KBttN41h/tPahmpaZavviwQ8q4rCkt5CD0HdVmfgPVA=
|
||||
github.com/Rosettea/readline-1 v0.1.0-beta.0.20211207003625-341c7985ad7d/go.mod h1:QiUAvbhg8PzCA4hlafCUl0bKD/0VmcocM4AjqtszAJs=
|
||||
github.com/Rosettea/readline-1 v0.1.0-beta.0.20220228022904-61f5e4493011 h1:+a61iNamZiO3Xru+l/1qtpKqqltVfWEm2r/rxH9hXxY=
|
||||
|
|
7
rl.go
7
rl.go
|
@ -217,13 +217,12 @@ func (lr *lineReader) Read() (string, error) {
|
|||
func (lr *lineReader) SetPrompt(prompt string) {
|
||||
halfPrompt := strings.Split(prompt, "\n")
|
||||
if len(halfPrompt) > 1 {
|
||||
lr.rl.Multiline = true
|
||||
lr.rl.SetPrompt(strings.Join(halfPrompt[:len(halfPrompt) - 1], "\n"))
|
||||
lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0]
|
||||
} else {
|
||||
// print cursor up ansi code
|
||||
//fmt.Printf("\033[1A")
|
||||
lr.rl.SetPrompt("")
|
||||
lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0]
|
||||
lr.rl.Multiline = false
|
||||
lr.rl.SetPrompt(prompt)
|
||||
}
|
||||
if !running {
|
||||
lr.rl.RefreshPromptInPlace("")
|
||||
|
|
Loading…
Reference in New Issue