Author Topic: Emoji highlighting error  (Read 1140 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Emoji highlighting error
« on: May 14, 2021, 04:59:41 PM »
Given the text
Code: [Select]
Symbol = '🌵'; (Emoji = U+01F335)
Placing the cursor just before the 1st quote, then shift-right to select.
Attached in the results of selecting 1, 2 and then 3 characters.
Notice that the emoji appears selected when only the quote should be.

I'm using Consolas font.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Emoji highlighting error
« Reply #1 on: May 14, 2021, 05:08:41 PM »
Also, it is not possible to mouse-click to set the cursor on to the emoji.
Clicking on the emoji puts the cursor to the right of it.
Clicking on the left edge of the emoji places the cursor on the first quote.

When you have multiple consecutive emojis
return "🌵🌵🌵🌵🌵"
Then the 1st one has both problems, but the remaining ones behave correctly for shift-select, but still have the click-select problem.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Emoji highlighting error
« Reply #2 on: May 14, 2021, 07:37:40 PM »
Reproduced on Windows. Not sure if this can be fixed but we will take a look

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Emoji highlighting error
« Reply #3 on: May 14, 2021, 11:20:07 PM »
Interesting. The win32 CharNextW function doesn't work for surrogates. You would think it would at least skip over them. Nope. It sometimes sends you into the middle of a surrogate sequence. SlickEdit uses it on windows to support composite character sequences which can consist of multiple unicode characters. SlickEdit does not support composite characters on Linux or macOS yet.

This will be fixed in 25.0.2

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Emoji highlighting error
« Reply #4 on: May 15, 2021, 01:50:16 AM »
Curious, because I tried in Outlook and even notepad - seems to work OK.
I would assume that at least Notepad would use the basic font rendering stuff in Windows.

Interesting ... In Outlook, 🌵 is green, but in Word and Notepad it is gray.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Emoji highlighting error
« Reply #5 on: May 15, 2021, 02:08:12 AM »
This is not a font rendering issue. CharNextW is used to traverse composite characters. Composite characters consist of multiple Unicode characters. SlickEdit checks in many places that composite characters, which are multiple unicode characters, are not bisected (selection doesn't bisect a composite character sequence). I tested some composite sequences in Notepad and it seems to traverse them correctly. They must be using something different than CharNextW or working around it's bugs.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Emoji highlighting error
« Reply #6 on: May 15, 2021, 03:08:35 AM »
Here's some sample text with a composite sequence:

Ax̂C

Copy the above text and paste into an XML or other unicode file on Windows. SlickEdit for macOS and Linux will treat the above as 4 unicode characters when you cursor left and right. Windows SlickEdit will treat the above sequence as 3 sets of characters.

Note that this forum does not display the above text correctly for me on Windows. The hat should be displayed above the 'x'.