summaryrefslogtreecommitdiff
path: root/vendor/github.com/Azure/go-ansiterm/ground_state.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Azure/go-ansiterm/ground_state.go')
-rw-r--r--vendor/github.com/Azure/go-ansiterm/ground_state.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/Azure/go-ansiterm/ground_state.go b/vendor/github.com/Azure/go-ansiterm/ground_state.go
new file mode 100644
index 000000000..52451e946
--- /dev/null
+++ b/vendor/github.com/Azure/go-ansiterm/ground_state.go
@@ -0,0 +1,24 @@
+package ansiterm
+
+type groundState struct {
+ baseState
+}
+
+func (gs groundState) Handle(b byte) (s state, e error) {
+ gs.parser.context.currentChar = b
+
+ nextState, err := gs.baseState.Handle(b)
+ if nextState != nil || err != nil {
+ return nextState, err
+ }
+
+ switch {
+ case sliceContains(printables, b):
+ return gs, gs.parser.print()
+
+ case sliceContains(executors, b):
+ return gs, gs.parser.execute()
+ }
+
+ return gs, nil
+}