Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ While agsearch is on `0.x`, the CLI surface may still change between minor
versions. Anything that changes it will be listed under **Changed** with the
migration in the same line.

## [Unreleased]

### Fixed

- **`agsearch read` no longer crashes on superscript digits.** A message containing `¹` or
`²` raised `ValueError` while condensing line numbers, because `isdigit()` accepts
characters `int()` cannot parse.

## [0.2.0] - 2026-09-05

Four more coding agents, and the transcript reader stops attributing machine
Expand Down
4 changes: 2 additions & 2 deletions agsearch
Original file line number Diff line number Diff line change
Expand Up @@ -1190,10 +1190,10 @@ def _condense_line_numbers(s, minrun=4):
toks = s.split(" ")
out, i, n = [], 0, len(toks)
while i < n:
if toks[i].isdigit():
if toks[i].isdecimal():
last, chain = int(toks[i]), [i]
for k in range(i + 1, n):
if toks[k].isdigit():
if toks[k].isdecimal():
v = int(toks[k])
if 0 < v - last <= 3: # small gaps = blank lines in the file
last, _ = v, chain.append(k)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ def test_a_missing_session_says_so_instead_of_raising(self):
self.assertIn("not found", buf.getvalue())


class LineNumberCondenseTests(unittest.TestCase):
def test_superscript_digits_do_not_crash(self):
# "¹".isdigit() is True but int("¹") raises; a footnote marker crashed `read`.
ag = load_agsearch()
out = ag._condense_line_numbers("note ¹ 1 a 2 b 3 c 4 d ² end")
self.assertEqual(out, "note ¹ [file] d ² end")


class BindingTests(unittest.TestCase):
"""ctrl-u and ctrl-d are fzf defaults (unix-line-discard, delete-char/eof).
Rebinding them takes away "clear the query", which is the edit people reach
Expand Down
Loading