Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braille: Variation Selectors break cursor positions #10960

Open
aaclause opened this issue Apr 8, 2020 · 8 comments · Fixed by #16477
Open

Braille: Variation Selectors break cursor positions #10960

aaclause opened this issue Apr 8, 2020 · 8 comments · Fixed by #16477
Assignees
Labels
bug/regression component/braille component/text-info TextInfo objects and text review p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority

Comments

@aaclause
Copy link
Contributor

aaclause commented Apr 8, 2020

Steps to reproduce:

  1. Consider the following line:

⚠️ test

  1. Move the cursor on the word (test) using routing cursors.

Actual behavior:

The cursor is moved on — the desired position + 1 —. Also ⚠️ takes 2 braille cells.

Expected behavior:

The cursor should be moved on the desired position. Also ⚠️ symbol should takes one cell only.
With wordpad and in form mode in Firefox, cursor is properly moved.

System configuration

NVDA installed/portable/running from source:

Installed and portable

NVDA version:

2019.3, 2020.1

Windows version:

10 Insider (64-bit) build 19592.1001

Name and version of other software in use when reproducing the issue:

notepad, Microsoft Word, Firefox (in browse mode), Run dialog (windows+r), etc..

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

No

If addons are disabled, is your problem still occuring?

Yes

Did you try to run the COM registry fixing tool in NVDA menu / tools?

No

CC @LeonarddeR

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Apr 8, 2020 via email

@aaclause
Copy link
Contributor Author

aaclause commented Apr 8, 2020

More details (according to my modest research):
⚠️ is composed of 2 characters: \x26a0 (⚠) and \xfe0f.
The issue comes from \xfe0f (variation selector-16). This character belongs to variation selectors Unicode block. It seems that all characters in this block are invisible codepoint which specify that the preceding character should be displayed with another presentation/color. Also it seems that we shouldn't reach these characters with keyboard (arrow keys, etc.).
In the end, these are all characters in this range (FE00 to FE0F) that break cursor positions. Another example: ⚠︀ = \x26A0 + \xfe00.
With NVDA 2019.2, we can move cursor on variation selectors. Therefore cursor positions are not broken.

@aaclause aaclause changed the title Braille: some characters break cursor positions Braille: Variation Selectors break cursor positions Apr 8, 2020
@LeonarddeR
Copy link
Collaborator

This is a difficult one. A quick solution would be: strip variation selectors from braille output. Not something I really like, as basically we're removing output that might be considered relevant for some people.

Thoughts @michaelDCurran @dkager @Adriani90 @lukaszgo1?

@LeonarddeR LeonarddeR added bug/regression component/text-info TextInfo objects and text review p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority labels Apr 9, 2020
@aaclause
Copy link
Contributor Author

aaclause commented May 7, 2020

It seems that there are other signs more complexes.
E.g.: 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣
0️⃣ *️⃣ #️⃣
3 braille cells per signs including U+FE0F and U+20E3 (variation selector-16) and combining enclosing keycap).

@aaclause
Copy link
Contributor Author

aaclause commented Jun 1, 2020

I've just made a first attempt in Braille Extender add-on, there's probably a better solution. See aaclause/BrailleExtender#63.
Doesn't work in wordpad and in Firefox (in form mode).

@LeonarddeR
Copy link
Collaborator

I'm pretty sure that in #16219, @mltony laid the groundwork to fix this. Braille cursor movement should start relying on code points rather than characters. As liblouis is using 32 bit internally, that will always match.

@LeonarddeR LeonarddeR self-assigned this May 2, 2024
seanbudd pushed a commit that referenced this issue May 7, 2024
Fixes #10960

Summary of the issue:
There are cases where moving one character on a textInfo instance actually moves more than one unicode point offset. This is described by @mltony in the doc string for textInfos.TextInfo.moveToCodepointOffset.
This causes of by one errors when cursor routing, since we're asking the textInfo to move by 1 characters, that might be presented by two or even more characters within the liblouis mapping.

Description of user facing changes
Cursor routing should be more reliable.

Description of development approach
@mltony's creation of moveToCodepointOffset allows us to move x code points from the start of the reading unit. As we're using 32 bit for liblouis, every character as presented by liblouis is equal to one code point. Therefore we can safely assume that this method to move is much more reliable than the previous method.
@nvaccessAuto nvaccessAuto added this to the 2024.3 milestone May 7, 2024
XLTechie pushed a commit to XLTechie/xlnvda that referenced this issue May 10, 2024
Fixes nvaccess#10960

Summary of the issue:
There are cases where moving one character on a textInfo instance actually moves more than one unicode point offset. This is described by @mltony in the doc string for textInfos.TextInfo.moveToCodepointOffset.
This causes of by one errors when cursor routing, since we're asking the textInfo to move by 1 characters, that might be presented by two or even more characters within the liblouis mapping.

Description of user facing changes
Cursor routing should be more reliable.

Description of development approach
@mltony's creation of moveToCodepointOffset allows us to move x code points from the start of the reading unit. As we're using 32 bit for liblouis, every character as presented by liblouis is equal to one code point. Therefore we can safely assume that this method to move is much more reliable than the previous method.
seanbudd pushed a commit that referenced this issue May 14, 2024
Reverts #16477 , #16497

Issues fixed
None

Issues reopened
Reopens #10960

Reason for revert
Feature turns out to be unstable.

Can this PR be reimplemented? If so, what is required for the next attempt
Use a feature flag
Ensure issues reported in Fix routing to account for rawToContentPos #16497 (comment) and Fix routing to account for rawToContentPos #16497 (comment) are covered by the fix
@seanbudd seanbudd removed this from the 2024.3 milestone May 14, 2024
@seanbudd seanbudd reopened this May 14, 2024
@LeonarddeR
Copy link
Collaborator

Unfortunately, my work had to be reverted due to an oversight in the code for UIA in Word. I'll try to fix this later this week.

@LeonarddeR
Copy link
Collaborator

The complexity here lies in the bullets and numbers part added in #8576

In this pr, @michaelDCurran changed bullet and number handling by adding the bullet/number to the line-prefix field on the format field before the text string. There are several problems with that approach:

  1. It only works reliably when the line has text after the bullet. If not, the bullet is exposed as text anyway
  2. It doesn't affect getting just the text of the textInfo, so when getting the text property on the TextInfo instance, the bullet is still exposed in text.

When the text in fields and the text without fields don't match, it is impossible to tell moveToUnicodePointOffset where to move to when routing braille.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/regression component/braille component/text-info TextInfo objects and text review p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants