selectel / pyte

Simple VTXXX-compatible linux terminal emulator
http://pyte.readthedocs.org/
GNU Lesser General Public License v3.0
658 stars 102 forks source link

set_margins() got an unexpected keyword argument 'private' #67

Closed anazmy closed 7 years ago

anazmy commented 7 years ago

testing latest master branch and python 2.7

Using

        self.screen = pyte.Screen(self.term_cols, self.term_rows)
        self.stream = pyte.ByteStream()
        self.stream.attach(self.screen)

When I exit out of a midnight commander screen mc I get an error reported by stream.feed(buf) , where buf is the below :

[4;2H
[37m
[44m/..                                    
[37m
[44m
[37m
[44mUP--DIR
[37m
[44m
[37m
[44mMar  1 05:06
[5;2H
[30m
[46m/.cache                                
     15
Mar  1 17:28
[26;2H
[37m
[44m/.cache
[29;17H
[5;2H
[37m
[44m/.cache                                
[37m
[44m
[37m
[44m     15
[37m
[44m
[37m
[44mMar  1 17:28
[6;2H
[30m
[46m/.config                               
     15
Mar  1 17:28
[26;5H
[37m
[44monfig
[29;17H
[6;2H
[37m
[44m/.config                               
[37m
[44m
[37m
[44m     15
[37m
[44m
[37m
[44mMar  1 17:28
[7;2H
[30m
[46m/.local                                
     18
Mar  1 17:28
[26;4H
[37m
[44mlocal 
[29;17H
[7;2H
[37m
[44m/.local                                
[37m
[44m
[37m
[44m     18
[37m
[44m
[37m
[44mMar  1 17:28
[8;2H
[30m
[46m .bash_history                         
    430
Mar  1 18:35
[26;2H
[37m
[44m .bash_history
[29;17H
[8;2H .bash_history                         
    430
Mar  1 18:35
[9;2H
[30m
[46m .bash_logout                          
     18
Mar  1 05:06
[26;9H
[37m
[44mlogout 
[29;17H
[9;2H .bash_logout                          
     18
Mar  1 05:06
[10;2H
[30m
[46m .bash_profile                         
    193
Mar  1 05:06
[26;9H
[37m
[44mprofile
[29;17H
[10;2H .bash_profile                         
    193
Mar  1 05:06
[12;2H
[30m
[46m afile                                 
     56
Mar  1 18:36
[26;3H
[37m
[44mafile        
[29;17H
[9;35H
[30m
[47m                                                        
[10;35H 
[34m The Midnight Commander 
[30m
[11;35H 
 Do you really want to quit the Midnight Commander? 
[12;35H 
[13;35H 

[46m[ 
[34mY
[30mes ]
[47m  [ 
[34mN
[30mo ]                   
[14;35H 
[15;35H                                                        
[13;57H
[28;7H
[39m
[49mBring text back from the dead with C-y.
[28;124H
[1;1H
[1;124H
[?1015l
[?1002l
[?1001r
[?1l
[30;1H
[39;49m
[?1049l
[?47l
[39;49m
]0;anazmy@db1:~
[anazmy@db1 ~]$ ls -alSh
superbobry commented 7 years ago

Thanks! Could you also share the value of $TERM in the environment of the mc process?

anazmy commented 7 years ago

It is TERM=xterm

superbobry commented 7 years ago

We do support some xterm extensions in pyte, but the contract is that pyte implements TERM=linux. Could you please verify that this quirk also happens with TERM=linux?

anazmy commented 7 years ago

It doesn't happen with TERM=linux but I think a side effect of using term=linux is that I cant capture mouse clicks

superbobry commented 7 years ago

If you need to use TERM=xterm then subclass pyte.Screen and override set_margins e.g. like this

class CustomScreen(pyte.Screen):
    def set_margins(self, *args, **kwargs):
        kwargs.pop("private", None)
        return super(CustomScreen, self).set_margins(*args, **kwargs)