|
15 | 15 | import unicodedata
|
16 | 16 | from six.moves import range
|
17 | 17 |
|
18 |
| -from pygments import format |
| 18 | +from pygments import format as pygformat |
19 | 19 | from bpython._py3compat import PythonLexer
|
20 | 20 | from pygments.formatters import TerminalFormatter
|
21 | 21 |
|
@@ -1126,7 +1126,7 @@ def push(self, line, insert_into_history=True):
|
1126 | 1126 |
|
1127 | 1127 | if self.config.syntax:
|
1128 | 1128 | display_line = bpythonparse(
|
1129 |
| - format(self.tokenize(line), self.formatter) |
| 1129 | + pygformat(self.tokenize(line), self.formatter) |
1130 | 1130 | )
|
1131 | 1131 | # self.tokenize requires that the line not be in self.buffer yet
|
1132 | 1132 |
|
@@ -1208,7 +1208,7 @@ def unhighlight_paren(self):
|
1208 | 1208 | self.highlighted_paren = None
|
1209 | 1209 | logger.debug("trying to unhighlight a paren on line %r", lineno)
|
1210 | 1210 | logger.debug("with these tokens: %r", saved_tokens)
|
1211 |
| - new = bpythonparse(format(saved_tokens, self.formatter)) |
| 1211 | + new = bpythonparse(pygformat(saved_tokens, self.formatter)) |
1212 | 1212 | self.display_buffer[lineno] = self.display_buffer[
|
1213 | 1213 | lineno
|
1214 | 1214 | ].setslice_with_length(
|
@@ -1276,7 +1276,7 @@ def current_line_formatted(self):
|
1276 | 1276 | """The colored current line (no prompt, not wrapped)"""
|
1277 | 1277 | if self.config.syntax:
|
1278 | 1278 | fs = bpythonparse(
|
1279 |
| - format(self.tokenize(self.current_line), self.formatter) |
| 1279 | + pygformat(self.tokenize(self.current_line), self.formatter) |
1280 | 1280 | )
|
1281 | 1281 | if self.incr_search_mode:
|
1282 | 1282 | if self.incr_search_target in self.current_line:
|
@@ -1766,7 +1766,7 @@ def reprint_line(self, lineno, tokens):
|
1766 | 1766 | logger.debug("calling reprint line with %r %r", lineno, tokens)
|
1767 | 1767 | if self.config.syntax:
|
1768 | 1768 | self.display_buffer[lineno] = bpythonparse(
|
1769 |
| - format(tokens, self.formatter) |
| 1769 | + pygformat(tokens, self.formatter) |
1770 | 1770 | )
|
1771 | 1771 |
|
1772 | 1772 | def take_back_buffer_line(self):
|
@@ -1920,7 +1920,7 @@ def show_source(self):
|
1920 | 1920 | self.status_bar.message("%s" % (e,))
|
1921 | 1921 | else:
|
1922 | 1922 | if self.config.highlight_show_source:
|
1923 |
| - source = format( |
| 1923 | + source = pygformat( |
1924 | 1924 | PythonLexer().get_tokens(source), TerminalFormatter()
|
1925 | 1925 | )
|
1926 | 1926 | self.pager(source)
|
|
0 commit comments