eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py

changeset 7249
0bf517e60f54
parent 6942
2602857055c5
child 7256
4ef3b78ebb4e
equal deleted inserted replaced
7248:60b48ab891fa 7249:0bf517e60f54
1321 newText = text 1321 newText = text
1322 else: 1322 else:
1323 newText = text[:col].rstrip() + text[col:].lstrip() 1323 newText = text[:col].rstrip() + text[col:].lstrip()
1324 1324
1325 # There could be an escaped newline 1325 # There could be an escaped newline
1326 # 1326 # like 'def foo(a=\
1327 # def foo(a=\ 1327 # 1)'
1328 # 1)
1329 if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')): 1328 if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')):
1330 self.__source[line] = newText.rstrip("\n\r \t\\") 1329 self.__source[line] = newText.rstrip("\n\r \t\\")
1331 self.__source[line + 1] = self.__source[line + 1].lstrip() 1330 self.__source[line + 1] = self.__source[line + 1].lstrip()
1332 else: 1331 else:
1333 self.__source[line] = newText 1332 self.__source[line] = newText
2113 2112
2114 first_row = self.tokens[0][2][0] 2113 first_row = self.tokens[0][2][0]
2115 nrows = 1 + self.tokens[-1][2][0] - first_row 2114 nrows = 1 + self.tokens[-1][2][0] - first_row
2116 2115
2117 # here are the return values 2116 # here are the return values
2118 valid_indents = [list()] * nrows 2117 valid_indents = [[]] * nrows
2119 indent_level = self.tokens[0][2][1] 2118 indent_level = self.tokens[0][2][1]
2120 valid_indents[0].append(indent_level) 2119 valid_indents[0].append(indent_level)
2121 2120
2122 if nrows == 1: 2121 if nrows == 1:
2123 # bug, really. 2122 # bug, really.

eric ide

mercurial