@@ -524,8 +524,7 @@ def handle_cursor_keys(self, key): ## keys which move, sanity checks later
524524 self .cur_line = max (self .cur_line , self .top_line )
525525 self .scroll_down (3 )
526526 elif key == KEY_TOGGLE : ## Toggle Autoindent/Statusline/Search case
527- pat = self .line_edit ("Case Sensitive Search %c, Autoindent %c, Tab Size %d, Write Tabs %c: " %
528- (self .case , self .autoindent , self .tab_size , self .write_tabs ), "" )
527+ pat = self .line_edit ("Case Sensitive Search {}, Autoindent {}, Tab Size {}, Write Tabs {}: " .format (self .case , self .autoindent , self .tab_size , self .write_tabs ), "" )
529528 try :
530529 res = [i .strip ().lower () for i in pat .split ("," )]
531530 if res [0 ]: self .case = 'y' if res [0 ][0 ] == 'y' else 'n'
@@ -801,8 +800,7 @@ def packtabs(self, s):
801800 return sb .getvalue ()
802801#endif
803802 def get_file (self , fname ):
804- from os import listdir
805- if fname in listdir ():
803+ try :
806804#ifdef LINUX
807805 if sys .implementation .name == "cpython" :
808806 with open (fname , errors = "ignore" ) as f :
@@ -811,8 +809,8 @@ def get_file(self, fname):
811809#endif
812810 with open (fname ) as f :
813811 content = f .readlines ()
814- else :
815- message = 'File {!r} is not in the local directory ' .format (fname )
812+ except Exception as err :
813+ message = 'Could not load {}, {!r} ' .format (fname , err )
816814 return (None , message )
817815 for i in range (len (content )): ## strip and convert
818816 content [i ] = self .expandtabs (content [i ].rstrip ('\r \n \t ' ))
0 commit comments