Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96ce8cef8d | ||
|
|
052945f9f8 | ||
|
|
aff8e0572a |
@@ -60,11 +60,13 @@ func (st *stateTracker) applyDiff(diff []byte, oldNum, newNum uint64) {
|
||||
// Need the base state to apply the diff.
|
||||
base, ok := st.states[oldNum]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
// Restore shadow to base state if needed.
|
||||
if st.shadowState != oldNum {
|
||||
// After a resize we have no states. Start fresh with a
|
||||
// clean emulator so the first post-resize diff works.
|
||||
st.shadow = vt.NewEmulator(st.cols, st.rows)
|
||||
st.shadowState = oldNum
|
||||
base = mosh.SnapshotEmulator(st.shadow, true)
|
||||
st.states[oldNum] = base
|
||||
} else if st.shadowState != oldNum {
|
||||
st.shadow = vt.NewEmulator(st.cols, st.rows)
|
||||
// Write the base framebuffer as ANSI to restore state.
|
||||
if base != nil {
|
||||
|
||||
+6
-4
@@ -15,8 +15,10 @@ const (
|
||||
attrFaint = 1 << 1
|
||||
attrItalic = 1 << 2
|
||||
attrBlink = 1 << 3
|
||||
attrReverse = 1 << 4
|
||||
attrStrikethrough = 1 << 5
|
||||
attrRapidBlink = 1 << 4
|
||||
attrReverse = 1 << 5
|
||||
attrConceal = 1 << 6
|
||||
attrStrikethrough = 1 << 7
|
||||
)
|
||||
|
||||
// Framebuffer represents a terminal screen state for mosh SSP.
|
||||
@@ -172,11 +174,11 @@ func (fb *Framebuffer) fullRedraw() []byte {
|
||||
buf = append(buf, "\r\n"...)
|
||||
}
|
||||
rowOff := y * fb.W
|
||||
// Track trailing spaces to avoid sending them.
|
||||
// Track trailing default-attr spaces to avoid sending them.
|
||||
lastNonSpace := -1
|
||||
for x := fb.W - 1; x >= 0; x-- {
|
||||
c := &fb.Cells[rowOff+x]
|
||||
if c.Rune != ' ' || c.Rune == 0 || c.Attr != (Attr{}) {
|
||||
if (c.Rune != ' ' && c.Rune != 0) || c.Attr != (Attr{}) {
|
||||
lastNonSpace = x
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user