@@ -19,6 +19,7 @@ func (p *Proxy) handleCSI(pty chan byte) (output []byte, original []byte, redraw
1919 'h' : p .csiSetModeHandler ,
2020 'l' : p .csiResetModeHandler ,
2121 'J' : p .csiEraseInDisplayHandler ,
22+ 'r' : p .csiSetMarginHandler ,
2223 }
2324
2425 var final byte
@@ -136,6 +137,13 @@ func (p *Proxy) csiLinePositionAbsolute(params []string, intermediate string) (o
136137 return []byte (fmt .Sprintf ("\033 [%dd" , newRow )), false , nil
137138}
138139
140+ // CSI Pt Pb r
141+ func (p * Proxy ) csiSetMarginHandler (params []string , intermediate string ) (output []byte , redraw bool , err error ) {
142+ // 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+ }
146+
139147// CSI Ps J
140148func (p * Proxy ) csiEraseInDisplayHandler (params []string , intermediate string ) (output []byte , redraw bool , err error ) {
141149
@@ -151,7 +159,7 @@ func (p *Proxy) csiEraseInDisplayHandler(params []string, intermediate string) (
151159 switch n {
152160 case "2" , "3" :
153161 row , col := p .HandleCoordinates (0 , 0 )
154- return []byte (fmt .Sprintf ("\033 [%d;%dH" , row , col )), true , ErrorCommandNotSupported
162+ return []byte (fmt .Sprintf ("\033 [%d;%dH" , row + 1 , col + 1 )), true , ErrorCommandNotSupported
155163 }
156164
157165 return nil , false , ErrorCommandNotSupported
0 commit comments