Skip to content

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>&zwj;‍👧".

Test plan

Screenshot 2022-07-08 at 17 17 59 Screenshot 2022-07-08 at 17 17 45 Screenshot 2022-07-08 at 17 17 33

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading