mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix compiling empty file
This commit is contained in:
parent
7eb0c1ae0d
commit
c094743e84
4 changed files with 3 additions and 1 deletions
|
@ -68,7 +68,7 @@ def did_you_mean(word: str, options: T.List[str]) -> T.Optional[str]:
|
|||
|
||||
|
||||
def idx_to_pos(idx: int, text: str) -> T.Tuple[int, int]:
|
||||
if idx == 0:
|
||||
if idx == 0 or len(text) == 0:
|
||||
return (0, 0)
|
||||
sp = text[:idx].splitlines(keepends=True)
|
||||
line_num = len(sp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue