Implement clear screen c-l binding
This commit is contained in:
parent
19bf07abd9
commit
b7816d26be
@ -252,6 +252,10 @@ func (self *Loop) AllowLineWrapping(allow bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *Loop) ClearScreen() {
|
||||
self.QueueWriteString("\x1b[H\x1b[2J")
|
||||
}
|
||||
|
||||
func (self *Loop) Quit(exit_code int) {
|
||||
self.exit_code = exit_code
|
||||
self.keep_going = false
|
||||
|
||||
@ -429,7 +429,12 @@ func (self *Readline) perform_action(ac Action, repeat_count uint) error {
|
||||
}
|
||||
}
|
||||
return self.perform_action(ActionCursorDown, repeat_count)
|
||||
|
||||
case ActionClearScreen:
|
||||
self.loop.StartAtomicUpdate()
|
||||
self.loop.ClearScreen()
|
||||
self.RedrawNonAtomic()
|
||||
self.loop.EndAtomicUpdate()
|
||||
return nil
|
||||
}
|
||||
return ErrCouldNotPerformAction
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ const (
|
||||
ActionHistoryNextOrCursorDown
|
||||
ActionHistoryNext
|
||||
ActionHistoryPrevious
|
||||
ActionClearScreen
|
||||
)
|
||||
|
||||
type Readline struct {
|
||||
|
||||
@ -35,6 +35,8 @@ var default_shortcuts = map[string]Action{
|
||||
"right": ActionCursorRight,
|
||||
"ctrl+f": ActionCursorRight,
|
||||
|
||||
"ctrl+l": ActionClearScreen,
|
||||
|
||||
"ctrl+d": ActionEndInput,
|
||||
"enter": ActionAcceptInput,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user