Skip to content

Search backend: redefine Location.Offset as a byte offset

Administrator requested to merge cc/byte-offset into main

Created by: camdencheek

Location.Offset was documented as a rune offset, but a rune offset from the beginning of the file is realistically not super useful. However, holding on to byte offsets from the beginning of file is useful, especially since these can then be used to safely index directly into the associated file or preview string.

Additionally, in a few places, Location.Offset was already being treated as a byte offset rather than a rune offset, so this makes it consistent.

Test plan

Updated associated tests to ensure highlighted strings are still generated correctly.

Merge request reports

Loading