Use softlines instead of hardlines for accessibility

Fixes #1149.

VoiceOver expects AXLineForIndex and AXRangeForLine to be consistent with
the movement by line using arrow up/down. That means it expects "line"
to mean softline.

VoiceOver also distinguishes commands to move by:
* paragraph (hardline): VO-Shift-PgUp/PgDown
* line (softline): VO-up/down

These are available when interacting with the text area (VO-Shift-down).

This commit therefore fixes the AXLineForIndex and AXRangeForLine
to make "line" mean "softline" instead of "hardline" as was the case
until now.
This commit is contained in:
Boris Dušek
2013-11-10 10:01:42 +01:00
committed by Allan Odgaard
parent e0298cf29c
commit 9f68cb416c

View File

@@ -1201,7 +1201,7 @@ doScroll:
} HANDLE_ATTR(Value) {
ret = [NSString stringWithCxxString:editor->as_string()];
} HANDLE_ATTR(InsertionPointLineNumber) {
ret = [NSNumber numberWithUnsignedLong:buffer.convert(editor->ranges().last().min().index).line];
ret = [NSNumber numberWithUnsignedLong:layout->softline_for_index(editor->ranges().last().min())];
} HANDLE_ATTR(NumberOfCharacters) {
ret = [NSNumber numberWithUnsignedInteger:[self nsRangeForRange:ng::range_t(0, buffer.size())].length];
} HANDLE_ATTR(SelectedText) {
@@ -1337,12 +1337,11 @@ doScroll:
} HANDLE_PATTR(LineForIndex) {
size_t index = [((NSNumber*)parameter) unsignedLongValue];
index = [self rangeForNSRange:NSMakeRange(index, 0)].min().index;
text::pos_t pos = document->buffer().convert(index);
ret = [NSNumber numberWithUnsignedLong:pos.line];
size_t line = layout->softline_for_index(index);
ret = [NSNumber numberWithUnsignedLong:line];
} HANDLE_PATTR(RangeForLine) {
size_t line = [((NSNumber*)parameter) unsignedLongValue];
size_t begin = document->buffer().begin(line), end = document->buffer().end(line);
ng::range_t const range(begin, end);
ng::range_t const range = layout->range_for_softline(line);
ret = [NSValue valueWithRange:[self nsRangeForRange:range]];
} HANDLE_PATTR(StringForRange) {
ng::range_t range = [self rangeForNSRange:[((NSValue*)parameter) rangeValue]];