Documentation ¶
Index ¶
- Constants
- type Complete
- func (c *Complete) Act(str string) string
- func (c *Complete) ActLarge(str string, feed chan string) string
- func (c *Complete) ActOne(x terminal.ActOn) string
- func (c *Complete) ApplyString(diff string) error
- func (c *Complete) Clone() *Complete
- func (c *Complete) DiffFrom(existing *Complete) string
- func (c *Complete) Equal(x *Complete) bool
- func (c *Complete) EqualTrace(x *Complete) bool
- func (c *Complete) GetDiff() string
- func (c *Complete) GetEchoAck() uint64
- func (c *Complete) GetEmulator() *terminal.Emulator
- func (c *Complete) InitDiff() string
- func (c *Complete) InitSize(nCols, nRows int)
- func (c *Complete) RegisterInputFrame(num uint64, now int64)
- func (c *Complete) Reset()
- func (c *Complete) ResetInput()
- func (c *Complete) SetEchoAck(now int64, inputEchoDone bool) (ret bool)
- func (c *Complete) SetTerminalCaps(caps map[int]string)
- func (c *Complete) Subtract(prefix *Complete)
- func (c *Complete) WaitTime(now int64) int
- type UserEvent
- type UserEventType
- type UserStream
- func (u *UserStream) ApplyString(diff string) error
- func (u *UserStream) Clone() *UserStream
- func (u *UserStream) DiffFrom(existing *UserStream) string
- func (u *UserStream) Empty() bool
- func (u *UserStream) Equal(x *UserStream) bool
- func (u *UserStream) EqualTrace(x *UserStream) bool
- func (u *UserStream) GetAction(i int) terminal.ActOn
- func (u *UserStream) InitDiff() string
- func (u *UserStream) InitSize(nCols, nRows int)
- func (u *UserStream) PushBack(x []rune)
- func (u *UserStream) PushBackResize(width, height int)
- func (u *UserStream) Reset()
- func (u *UserStream) ResetInput()
- func (u *UserStream) Size() int
- func (u *UserStream) String() string
- func (u *UserStream) Subtract(prefix *UserStream)
Constants ¶
const (
ECHO_TIMEOUT = 50 // for late ack
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Complete ¶
type Complete struct {
// contains filtered or unexported fields
}
Complete implements network.State[C any] interface
func NewComplete ¶
func (*Complete) ApplyString ¶
implements network.State[C any] interface convert differene content into HostMessage, and apply the instructions to the terminal.
func (*Complete) DiffFrom ¶
implements network.State[C any] interface compare two Complete value and build the seralized HostMessage: difference content.
func (*Complete) EqualTrace ¶
fot test purpose implements network.State[C any] interface
func (*Complete) GetEchoAck ¶
func (*Complete) GetEmulator ¶
func (*Complete) InitDiff ¶
implements network.State[C any] interface get difference between this Complete and a new one.
func (*Complete) RegisterInputFrame ¶
register the latest remote state number and time. the latest remote state is the client input state.
func (*Complete) ResetInput ¶
func (c *Complete) ResetInput()
implements network.State[C any] interface
func (*Complete) SetEchoAck ¶
shrink input history according to timestamp. return true if newestEchoAck changed. update echoAck if find the newest state.
func (*Complete) SetTerminalCaps ¶
func (*Complete) WaitTime ¶
return 0 if history frame state + 50ms < now. That means now is larger than 50ms. return max int if there is only one history frame. return normal gap between now and history frame + 50ms.
if the frame is not acked after ECHO_TIMEOUT, give short WaitTime to accelerate ack actions.
type UserEvent ¶
type UserEvent struct {
// contains filtered or unexported fields
}
UserByte instance is created by aprish client, when client got the user input. Resize instance is created by aprish client, when client change the window size.
func NewUserEvent ¶
func NewUserEventResize ¶
type UserEventType ¶
type UserEventType uint8
const ( UserByteType UserEventType = iota ResizeType )
type UserStream ¶
type UserStream struct {
// contains filtered or unexported fields
}
UserStream implements network.State[C any] interface
func (*UserStream) ApplyString ¶
func (u *UserStream) ApplyString(diff string) error
implements network.State[C any] interface convert the UserMessage into a UserStream
func (*UserStream) Clone ¶
func (u *UserStream) Clone() *UserStream
implements network.State[C any] interface
func (*UserStream) DiffFrom ¶
func (u *UserStream) DiffFrom(existing *UserStream) string
implements network.State[C any] interface DiffFrom() exclude the existing UserEvent and return the difference.
func (*UserStream) Empty ¶
func (u *UserStream) Empty() bool
func (*UserStream) Equal ¶
func (u *UserStream) Equal(x *UserStream) bool
implements network.State[C any] interface
func (*UserStream) EqualTrace ¶
func (u *UserStream) EqualTrace(x *UserStream) bool
for test purpose
func (*UserStream) InitDiff ¶
func (u *UserStream) InitDiff() string
implements network.State[C any] interface
func (*UserStream) InitSize ¶
func (u *UserStream) InitSize(nCols, nRows int)
func (*UserStream) PushBack ¶
func (u *UserStream) PushBack(x []rune)
func (*UserStream) PushBackResize ¶
func (u *UserStream) PushBackResize(width, height int)
func (*UserStream) Reset ¶
func (u *UserStream) Reset()
func (*UserStream) ResetInput ¶
func (u *UserStream) ResetInput()
implements network.State[C any] interface
func (*UserStream) Size ¶
func (u *UserStream) Size() int
func (*UserStream) String ¶
func (u *UserStream) String() string
func (*UserStream) Subtract ¶
func (u *UserStream) Subtract(prefix *UserStream)
implements network.State[C any] interface Subtract() the prefix UserStream from current UserStream