Author Topic: Incorrect counting of non-asci characters in a string  (Read 358 times)

vovaext

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Incorrect counting of non-asci characters in a string
« on: September 15, 2020, 02:14:51 am »
Hello.
The SlickEdit incorrectly counts the number of characters in a non-ASCII line
This bug has appeared a long time ago. I think in version 25 it will be the same.

Example:

~ asci-encoded string

'qwertyuiop'
Press Shift + right arrow
Number of characters counted SlickEdit - 10

~ non asci-encoded string

'йцукенгшщз'
Press Shift + right arrow
Number of characters counted SlickEdit - 20

The number of characters is doubled.


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Incorrect counting of non-asci characters in a string
« Reply #1 on: September 15, 2020, 02:35:17 am »
This was done this way for performance reasons (requires counting Utf-8 characters or DBCS characters). However, for small selections like this one, this could be improved for sure.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Incorrect counting of non-asci characters in a string
« Reply #2 on: September 15, 2020, 09:32:45 pm »
Improved this for beta 4. For small single character selections in Utf-8 files (not DBCS), the status line will display the number of Utf-8 characters.

jc44

  • Senior Community Member
  • Posts: 283
  • Hero Points: 18
Re: Incorrect counting of non-asci characters in a string
« Reply #3 on: September 17, 2020, 11:30:23 am »
Having just tried this for my interest, will this also fix column insertion?  In Brief with Beta 3:

Starting with a file containing:
Code: [Select]
йцукенгшщз
0123456789

Starting with cursor at the start of text.  <right><right><alt-C><right><right><down><keypad +><up><insert>

You get:
Code: [Select]
йцукеукенгшщз
0123423456789

where the insert has occurred in different places on different lines.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Incorrect counting of non-asci characters in a string
« Reply #4 on: September 17, 2020, 12:43:29 pm »
No change for column/block selections. This change will only effect character selections.

jc44

  • Senior Community Member
  • Posts: 283
  • Hero Points: 18
Re: Incorrect counting of non-asci characters in a string
« Reply #5 on: September 18, 2020, 03:09:08 pm »
As it stands (Beta 4) this fix only works for char selections on a single line. Is there any chance of expanding it to at least get "Col" in the status line correct - it is really wierd the way you jump from col 4 to col 7 by hitting <up>? But I imagine that getting unicode support "right" is a versions worth of effort and the demand isn't here - I admit I am only poking it for interest rather than out of any expectation of use.