mirror of https://github.com/Hilbis/Hilbish
feat(hilbish.editor): add getLine function to get contents of line
parent
09a8b41063
commit
3e0a2d630b
|
@ -11,6 +11,7 @@ func editorLoader(rtm *rt.Runtime) *rt.Table {
|
|||
"insert": {editorInsert, 1, false},
|
||||
"setVimRegister": {editorSetRegister, 1, false},
|
||||
"getVimRegister": {editorGetRegister, 2, false},
|
||||
"getLine": {editorGetLine, 0, false},
|
||||
}
|
||||
|
||||
mod := rt.NewTable()
|
||||
|
@ -68,3 +69,9 @@ func editorGetRegister(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
|||
|
||||
return c.PushingNext1(t.Runtime, rt.StringValue(string(buf))), nil
|
||||
}
|
||||
|
||||
func editorGetLine(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||
buf := lr.rl.GetLine()
|
||||
|
||||
return c.PushingNext1(t.Runtime, rt.StringValue(string(buf))), nil
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ func (rl *Instance) updateLine(line []rune) {
|
|||
|
||||
// getLine - In many places we need the current line input. We either return the real line,
|
||||
// or the one that includes the current completion candidate, if there is any.
|
||||
func (rl *Instance) getLine() []rune {
|
||||
func (rl *Instance) GetLine() []rune {
|
||||
if len(rl.currentComp) > 0 {
|
||||
return rl.lineComp
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func delayedSyntaxTimer(rl *Instance, i int64) {
|
|||
// }
|
||||
|
||||
// We pass either the current line or the one with the current completion.
|
||||
newLine := rl.DelayedSyntaxWorker(rl.getLine())
|
||||
newLine := rl.DelayedSyntaxWorker(rl.GetLine())
|
||||
var sLine string
|
||||
count := atomic.LoadInt64(&rl.delayedSyntaxCount)
|
||||
if count != i {
|
||||
|
|
Loading…
Reference in New Issue