@@ -20,6 +20,8 @@ func (p *Proxy) handleCSI(pty chan byte) (output []byte, original []byte, redraw
2020 'l' : p .csiResetModeHandler ,
2121 'J' : p .csiEraseInDisplayHandler ,
2222 'r' : p .csiSetMarginHandler ,
23+ 's' : p .csiSavePositionHandler ,
24+ 'u' : p .csiRestorePositionHandler ,
2325 }
2426
2527 var final byte
@@ -140,8 +142,8 @@ func (p *Proxy) csiLinePositionAbsolute(params []string, intermediate string) (o
140142// CSI Pt Pb r
141143func (p * Proxy ) csiSetMarginHandler (params []string , intermediate string ) (output []byte , redraw bool , err error ) {
142144 // pass through command, and inject reset position afterwards
143- row , col := p .HandleCoordinates (0 , 0 )
144- return []byte (fmt .Sprintf ("\033 [%d;%dH" , row + 1 , col + 1 )), true , ErrorCommandNotSupported
145+ row , col := p .HandleCoordinates (1 , 1 )
146+ return []byte (fmt .Sprintf ("\033 [%d;%dH" , row , col )), true , ErrorCommandNotSupported
145147}
146148
147149// CSI Ps J
@@ -158,8 +160,8 @@ func (p *Proxy) csiEraseInDisplayHandler(params []string, intermediate string) (
158160
159161 switch n {
160162 case "2" , "3" :
161- row , col := p .HandleCoordinates (0 , 0 )
162- return []byte (fmt .Sprintf ("\033 [%d;%dH" , row + 1 , col + 1 )), true , ErrorCommandNotSupported
163+ row , col := p .HandleCoordinates (1 , 1 )
164+ return []byte (fmt .Sprintf ("\033 [%d;%dH" , row , col )), true , ErrorCommandNotSupported
163165 }
164166
165167 return nil , false , ErrorCommandNotSupported
@@ -213,3 +215,15 @@ func (p *Proxy) csiSetMode(modeStr string, enabled bool) (output []byte, redraw
213215
214216 return nil , redraw , ErrorCommandNotSupported
215217}
218+
219+ // CSI Ps s
220+ func (p * Proxy ) csiSavePositionHandler (params []string , intermediate string ) (output []byte , redraw bool , err error ) {
221+ p .pauseDrawing = true
222+ return nil , false , ErrorCommandNotSupported
223+ }
224+
225+ // CSI Ps u
226+ func (p * Proxy ) csiRestorePositionHandler (params []string , intermediate string ) (output []byte , redraw bool , err error ) {
227+ p .pauseDrawing = false
228+ return nil , false , ErrorCommandNotSupported
229+ }
0 commit comments