Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 20, 2026

Description

This PR fixes an issue where chunk overlap was calculated using an arbitrary magic number (40) division, which resulted in minimal and inconsistent overlap regardless of the configuration.

Changes

  • Replaced the chunk_overlap / 40 logic with a character-based overlap calculation.
  • The new logic walks backwards from the current line to find a starting point that satisfies the chunk_overlap character count (or slightly exceeds it to include complete lines).
  • Updated both src/core/indexer.rs and src/watcher.rs.

Verification

  • Verified that the overlap now properly respects the configured character count (default 64) rather than being 1-2 lines.
  • Ran existing tests to ensure no regressions.

Replaces the arbitrary magic number 40 division with a character-based overlap calculation that respects the configured chunk_overlap setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants