MCPcopy Index your code
hub / github.com/bpython/bpython / unhighlight_paren

Method unhighlight_paren

bpython/curtsiesfrontend/repl.py:1330–1349  ·  view source on GitHub ↗

Modify line in self.display_buffer to unhighlight a paren if possible. self.highlighted_paren should be a line in ?

(self)

Source from the content-addressed store, hash-verified

1328 self.clear_current_block(remove_from_history=False)
1329
1330 def unhighlight_paren(self):
1331 """Modify line in self.display_buffer to unhighlight a paren if
1332 possible.
1333
1334 self.highlighted_paren should be a line in ?
1335 """
1336 if self.highlighted_paren is not None and self.config.syntax:
1337 lineno, saved_tokens = self.highlighted_paren
1338 if lineno == len(self.display_buffer):
1339 # then this is the current line, so don't worry about it
1340 return
1341 self.highlighted_paren = None
1342 logger.debug("trying to unhighlight a paren on line %r", lineno)
1343 logger.debug("with these tokens: %r", saved_tokens)
1344 new = bpythonparse(pygformat(saved_tokens, self.formatter))
1345 self.display_buffer[lineno] = self.display_buffer[
1346 lineno
1347 ].setslice_with_length(
1348 0, len(new), new, len(self.display_buffer[lineno])
1349 )
1350
1351 def clear_current_block(self, remove_from_history=True):
1352 self.display_buffer = []

Callers 4

keyboard_interruptMethod · 0.95
_set_current_lineMethod · 0.95
_set_cursor_offsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected