mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows Accessibility: Fix single-character range/boundary calculation
Narrator on Windows seems to call ExpandToEnclosingUnit to find the character immediately following the current cursor position. When expanding a degenerate range with position `input` (used to represent the cursor position) to a single-character range, the returned range should start at `input` and end at `input+1`. Previously, findTextBoundary() would always return the position before currentPosition when searching backwards by character, so the result of ExpandToEnclosingUnit would be off-by-one when expanding to the closest character.
This commit is contained in:
parent
e5255eb76c
commit
92f350e617
1 changed files with 2 additions and 2 deletions
|
|
@ -50,12 +50,12 @@ namespace AccessibilityTextHelpers
|
|||
const auto numCharacters = textInterface.getTotalNumCharacters();
|
||||
const auto isForwards = (direction == Direction::forwards);
|
||||
|
||||
auto offsetWithDirecton = [isForwards] (int input) { return isForwards ? input : -input; };
|
||||
const auto offsetWithDirecton = [isForwards] (int input) { return isForwards ? input : -input; };
|
||||
|
||||
switch (boundary)
|
||||
{
|
||||
case BoundaryType::character:
|
||||
return jlimit (0, numCharacters, currentPosition + offsetWithDirecton (1));
|
||||
return jlimit (0, numCharacters, isForwards ? currentPosition + 1 : currentPosition);
|
||||
|
||||
case BoundaryType::word:
|
||||
case BoundaryType::line:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue