Skip to content

Commit c188772

Browse files
committed
Bump 2.0.1: fixes, docs & API cleanup
Release bump to 2.0.1 with bug fixes, internal refactors, docs/examples updates, and tests. Changes: - Bumped package version to 2.0.1 and added changelog entry. - Fix truncate behavior: do not append suffix when text already fits within max_len. - Make starts_with_any / ends_with_any grapheme-aware (use public starts_with/ends_with). - Correct center docs to indicate right-biased padding when uneven. - Simplify find_emoji_index API (remove unused start parameter) and tighten its loop. - Replace repeat_str implementation to a direct recursive loop to avoid intermediate list allocation. - Update examples and docs to use the public `str` API (and `str/advanced` where applicable) and to reflect internal module path changes (src/str/internal/*). - Update tokenizer docs to reference public `str.chars` / `str.chars_stdlib` and mark internal tokenizer module. - Add regression tests for truncate noop, grapheme-aware starts/ends_with_any, and center right-bias. Other: various documentation cleanups and example callsite adjustments to match the 2.0 public API.
1 parent a0ccffc commit c188772

8 files changed

Lines changed: 240 additions & 159 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes to this project are documented in this file.
44

5+
## [2.0.1] - 2026-02-28
6+
7+
### Fixed
8+
9+
- **`truncate_with_flag`**: text that already fits within `max_len` was still being truncated when `text_len + suffix_len > max_len`. For example `truncate("Hello!", 8, "...")` returned `"Hello..."` instead of `"Hello!"`. The suffix is now only appended when the text is actually cut.
10+
- **`starts_with_any` / `ends_with_any`**: used the stdlib's byte-level `string.starts_with`/`string.ends_with` instead of the library's grapheme-aware versions, causing incorrect matches on strings with combining marks (e.g. `"e\u{0301}"` would wrongly match prefix `"e"`).
11+
- **`center` doc comment**: stated "left side receives more" but the implementation gives more padding to the right side. Comment corrected.
12+
13+
### Changed
14+
15+
- **`find_emoji_index`**: removed unused `start` parameter that was always passed as `0`, simplified the internal loop.
16+
- **`repeat_str`**: replaced `list.range` + `list.fold` with a direct recursive loop to avoid an intermediate list allocation.
17+
18+
### Tests
19+
20+
- Added regression tests for the `truncate` noop case, grapheme-aware `starts_with_any`/`ends_with_any`, and `center` right-bias.
21+
22+
### Documentation
23+
24+
- Updated examples and documentation to reflect the 2.0 public API and clean up outdated snippets.
25+
26+
Contributed by: Daniele (`lupodevelop`)
27+
28+
---
29+
530
## [2.0.0] - 2026-01-24
631

732
### Major Release — Unified API

0 commit comments

Comments
 (0)