SIGN IN SIGN UP

Avoid subtraction overflow when excerpt primary is outside of excerpt… (#24213)

This fixes a "subtract with overflow" error that could happen in debug
mode when viewing the project diagnostics.

From git bisecting, I think that this behavior was introduced by
https://github.com/zed-industries/zed/pull/21942. It seems like it's
possible in some cases for the excerpt-expansion heuristic to cause the
excerpt's `context` range to start *after* the excerpt's `primary`
range. We should probably revisit that heuristic at some point, but it
also seems reasonable to handle that situation at this layer, rather
than overflowing.

Release Notes:

- N/A
M
Max Brunsfeld committed
27d1c689cf8a772cf0ebbb9eee51619b3fe4f7fc
Parent: 4ab4e87
Committed by GitHub <noreply@github.com> on 2/4/2025, 6:24:05 PM