Reset when given Ctrl+C
This commit is contained in:
parent
1911969a1d
commit
66c8d4ca5c
@ -60,7 +60,11 @@ func (p *Prompt) Run() {
|
|||||||
p.renderer.BreakLine(p.buf, res)
|
p.renderer.BreakLine(p.buf, res)
|
||||||
p.buf = NewBuffer()
|
p.buf = NewBuffer()
|
||||||
p.selected = -1
|
p.selected = -1
|
||||||
} else if ac.Key == ControlC || ac.Key == ControlD {
|
} else if ac.Key == ControlC {
|
||||||
|
p.renderer.BreakLine(p.buf, "")
|
||||||
|
p.buf = NewBuffer()
|
||||||
|
p.selected = -1
|
||||||
|
} else if ac.Key == ControlD {
|
||||||
return
|
return
|
||||||
} else if ac.Key == BackTab || ac.Key == Up {
|
} else if ac.Key == BackTab || ac.Key == Up {
|
||||||
p.selected -= 1
|
p.selected -= 1
|
||||||
|
@ -149,13 +149,16 @@ func (r *Render) BreakLine(buffer *Buffer, result string) {
|
|||||||
r.out.EraseDown()
|
r.out.EraseDown()
|
||||||
r.renderPrefix()
|
r.renderPrefix()
|
||||||
|
|
||||||
// Rendering
|
// Render Line Break
|
||||||
r.out.SetColor(r.inputTextColor, r.inputBGColor)
|
r.out.SetColor(r.inputTextColor, r.inputBGColor)
|
||||||
r.out.WriteStr(buffer.Document().Text + "\n")
|
r.out.WriteStr(buffer.Document().Text + "\n")
|
||||||
r.out.SetColor(r.outputTextColor, r.outputBGColor)
|
|
||||||
r.out.WriteStr(result + "\n")
|
// Render Result
|
||||||
|
if result != "" {
|
||||||
|
r.out.SetColor(r.outputTextColor, r.outputBGColor)
|
||||||
|
r.out.WriteStr(result + "\n")
|
||||||
|
}
|
||||||
r.out.SetColor(DefaultColor, DefaultColor)
|
r.out.SetColor(DefaultColor, DefaultColor)
|
||||||
r.renderPrefix()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatCompletions(words []string, max int, prefix string, suffix string) (new []string, width int) {
|
func formatCompletions(words []string, max int, prefix string, suffix string) (new []string, width int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user