Commit ac78d6fd authored by Tom Niget's avatar Tom Niget

Update __init__.py

parent f7dfa5e4
......@@ -126,7 +126,13 @@ def exception_hook(exc_type, exc_value, tb):
def find_indices(s, indices: list[int]) -> list[int]:
"""
Matches indices to an ANSI-colored string
Matches indices to an ANSI-colored string.
:param s: An input string. This will usually be a line from a Python file that has been highlighted using Pygments.
:param indices: A list of indices to match. These will come from the `ast` parser and are UTF-8 *byte* offsets,
not *characters*!
:return: A list of *character* offsets that match the given indices, such text can be inserted at these indices and
end up in the expected place.
"""
results = set()
i = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment