hey, while exploring vimgpt/utils.py, i noticed that render_text() accesses the row before validating the cursor
current implementation:
cols = len(lines[rowOneIdx - 1])
with_cursor = insert_cursor(text, rowOneIdx, colOneIdx)
since validation happens inside insert_cursor(), an invalid rowOneIdx causes an IndexError before the intended validation is triggered e.g.
render_text(None, "hello", (10, 0))
raises IndexError: list index out of range instead of ValueError: Invalid row
given that cursor positions are likely derived from LLM-generated actions, invalid row indices are realistically possible and should be defensively handled at the render layer.
let me know if it was an oversight or am i missing something,
hey, while exploring
vimgpt/utils.py, i noticed thatrender_text()accesses the row before validating the cursorcurrent implementation:
since validation happens inside
insert_cursor(), an invalidrowOneIdxcauses anIndexErrorbefore the intended validation is triggered e.g.raises
IndexError: list index out of rangeinstead ofValueError: Invalid rowgiven that cursor positions are likely derived from LLM-generated actions, invalid row indices are realistically possible and should be defensively handled at the render layer.
let me know if it was an oversight or am i missing something,