core/tools: edit_lineno unread error names the read window

The boundary overguard (read offset=50 shows lines 51+, then editing
line 50 fails) forced blind re-reads. The error now reports the read
window ("this turn read lines 51-86") and advises reading with a margin
around the target range; read_file's description says the same.
This commit is contained in:
2026-08-15 17:38:58 +08:00
parent c9815e32bb
commit 38671482f2
3 changed files with 23 additions and 2 deletions
+12
View File
@@ -38,6 +38,18 @@ def test_edit_lineno_read_truncated_marks_only_displayed_lines(workspace: object
assert "not read" in out and "90" in out
def test_edit_lineno_error_shows_read_window(workspace: object) -> None:
"""The unread error names the read window so the model can re-read precisely."""
del workspace
_ = call_sync(write_file, "j.txt", "a\nb\nc\nd\n")
_ = reset_lineno_tracker()
_ = call_sync(read_file, "j.txt", offset=1, limit=2, with_lineno=True) # lines 2-3
out = call_sync(edit_lineno, "j.txt", 1, 1, "X\n")
assert "not read" in out
assert "read lines 2-3" in out
assert "margin" in out
def test_edit_lineno_requires_all_lines_read(workspace: object) -> None:
del workspace
_ = call_sync(write_file, "r.txt", "a\nb\nc\nd\ne\n")