Author Topic: Emoji highlighting error  (Read 306 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2201
  • Hero Points: 192
  • 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: 2201
  • Hero Points: 192
  • 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: 5784
  • Hero Points: 461
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: 5784
  • Hero Points: 461
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: 2201
  • Hero Points: 192
  • 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: 5784
  • Hero Points: 461
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: 5784
  • Hero Points: 461
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'.