JetBrains: Fix highlight offsets for lines containing emojis in the search result list
Created by: philipp-spiess
Part of #38222 (closed)
Since a fix for the native code preview block is more complex than I immediately thought, I decided to split off this first part into a separate PR.
The indices that we receive from the Sourcegraph API are unicode code pointer offsets rather than byte lengths so our highlighting logic needs to account for that rather than use String#length
.
There's one known issue remaining after this change which is out of scope to be fixed now:
The <span>
might cut-off a joined emoji sequence in-between a . For example if the content contains "👨👩👧👧"
but we search for "👨👩👧"
, we will highlight only a section of the joined sequence, e.g.: "<span>👨👩👧</span>‍👧"
.
Test plan
App preview:
Check out the client app preview documentation to learn more.