Skip to content

fix: cursor between boundaries crash - #940

Open
ltpie123 wants to merge 1 commit into
dlvhdr:mainfrom
ltpie123:fix/comment-boundary-issue
Open

fix: cursor between boundaries crash#940
ltpie123 wants to merge 1 commit into
dlvhdr:mainfrom
ltpie123:fix/comment-boundary-issue

Conversation

@ltpie123

@ltpie123 ltpie123 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

When the mentions.go does the check to see if there is a username after
an "@", the cursors loc was able to get out of bounds, causing a
runtime error. Now userStart is able to be the same value as len(runes).

Testing process

  • Created TestUserMentionSourceCursorBetweenBoundaries in source_test.go and tested against the unchanged main branch and found panics with "slice bounds out of range [7:6]"
  • Updated the mentions.go to fix the bounds
  • Tested again and found no regression
  • Green on full test suite

Video Solution

comment-boundary-issue-solved

when the mentions.go does the check to see if there is a username after
an "@", the cursors loc was  able to get out of bounds, causing a
runtime error. now userStart is able to be the same value as len(runes).
fixes dlvhdr#939
@github-actions

This comment has been minimized.

@ltpie123
ltpie123 marked this pull request as draft July 22, 2026 22:49
@ltpie123
ltpie123 marked this pull request as ready for review July 22, 2026 22:50
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.

[BUG] Crash when comment cursor moves between boundary runes

1 participant