More work on readline

This commit is contained in:
Kovid Goyal
2022-10-04 13:33:13 +05:30
parent 565526624f
commit c8296a44eb
5 changed files with 197 additions and 1 deletions

View File

@@ -193,6 +193,40 @@ func (self *Loop) Beep() {
self.QueueWriteString("\a")
}
func (self *Loop) StartAtomicUpdate() {
self.QueueWriteString(PENDING_UPDATE.EscapeCodeToSet())
}
func (self *Loop) EndAtomicUpdate() {
self.QueueWriteString(PENDING_UPDATE.EscapeCodeToReset())
}
func (self *Loop) SetCursorShape(shape CursorShapes, blink bool) {
self.QueueWriteString(CursorShape(shape, blink))
}
func (self *Loop) MoveCursorHorizontally(amt int) {
suffix := "C"
if amt < 0 {
suffix = "D"
amt *= -1
}
self.QueueWriteString(fmt.Sprintf("\x1b[%d%s", amt, suffix))
}
func (self *Loop) MoveCursorVertically(amt int) {
suffix := "B"
if amt < 0 {
suffix = "A"
amt *= -1
}
self.QueueWriteString(fmt.Sprintf("\x1b[%d%s", amt, suffix))
}
func (self *Loop) ClearToEndOfScreen() {
self.QueueWriteString("\x1b[J")
}
func (self *Loop) Quit(exit_code int) {
self.exit_code = exit_code
self.keep_going = false