mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows Accessibility: Fixed backspace character reporting under NVDA
The change introduced in 92f350e617 led to
a regression in the MoveEndpointByUnit function. In this case, a
backward movement by a single character *should* move the endpoint as
long as it remains within the text range.
The issue addressed by the faulty commit is better fixed by
special-casing the 'character' unit case in the ExpandToEnclosingUnit
function.
This commit is contained in:
parent
ccd3a29cc7
commit
7b1fba4bae
2 changed files with 6 additions and 5 deletions
|
|
@ -49,13 +49,12 @@ namespace AccessibilityTextHelpers
|
|||
{
|
||||
const auto numCharacters = textInterface.getTotalNumCharacters();
|
||||
const auto isForwards = (direction == Direction::forwards);
|
||||
|
||||
const auto offsetWithDirecton = [isForwards] (int input) { return isForwards ? input : -input; };
|
||||
const auto offsetWithDirection = [isForwards] (auto num) { return isForwards ? num : -num; };
|
||||
|
||||
switch (boundary)
|
||||
{
|
||||
case BoundaryType::character:
|
||||
return jlimit (0, numCharacters, isForwards ? currentPosition + 1 : currentPosition);
|
||||
return jlimit (0, numCharacters, currentPosition + offsetWithDirection (1));
|
||||
|
||||
case BoundaryType::word:
|
||||
case BoundaryType::line:
|
||||
|
|
@ -96,7 +95,7 @@ namespace AccessibilityTextHelpers
|
|||
auto tokens = (boundary == BoundaryType::line ? StringArray::fromLines (text)
|
||||
: StringArray::fromTokens (text, false));
|
||||
|
||||
return currentPosition + offsetWithDirecton (tokens[0].length());
|
||||
return currentPosition + offsetWithDirection (tokens[0].length());
|
||||
}
|
||||
|
||||
case BoundaryType::document:
|
||||
|
|
|
|||
|
|
@ -248,7 +248,9 @@ private:
|
|||
{
|
||||
const auto boundaryType = getBoundaryType (unit);
|
||||
|
||||
const auto start = AccessibilityTextHelpers::findTextBoundary (*textInterface,
|
||||
const auto start = unit == ComTypes::TextUnit::TextUnit_Character
|
||||
? selectionRange.getStart()
|
||||
: AccessibilityTextHelpers::findTextBoundary (*textInterface,
|
||||
selectionRange.getStart(),
|
||||
boundaryType,
|
||||
AccessibilityTextHelpers::Direction::backwards);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue