Skip to content
Snippets Groups Projects
Commit 96e2c6ac authored by George Nachman's avatar George Nachman
Browse files

Failed attempt to support accessibility for current URL

parent 6c41394f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5859,6 +5859,17 @@ ITERM_WEAKLY_REFERENCEABLE
return [_shell getWorkingDirectory];
}
 
- (NSURL *)textViewCurrentLocation {
VT100RemoteHost *host = [self currentHost];
NSString *path = _lastDirectory ?: [_shell getWorkingDirectory];
NSURLComponents *components = [[[NSURLComponents alloc] init] autorelease];
components.host = host.hostname;
components.user = host.username;
components.path = path;
components.scheme = @"file";
return [components URL];
}
- (BOOL)textViewShouldPlaceCursorAt:(VT100GridCoord)coord verticalOk:(BOOL *)verticalOk {
if (coord.y < _screen.numberOfLines - _screen.height ||
coord.x < 0 ||
Loading
Loading
Loading
Loading
@@ -172,6 +172,9 @@ typedef NS_ENUM(NSInteger, PTYTextViewSelectionExtensionUnit) {
// The background color in the color map changed.
- (void)textViewBackgroundColorDidChange;
 
// Describes the current user, host, and path.
- (NSURL *)textViewCurrentLocation;
@end
 
@interface PTYTextView : NSView <
Loading
Loading
Loading
Loading
@@ -7337,6 +7337,10 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
minimumLineNumber:[self accessibilityHelperLineNumberForAccessibilityLineNumber:0]];
}
 
- (NSURL *)accessibilityHelperCurrentDocumentURL {
return [_delegate textViewCurrentLocation];
}
- (screen_char_t *)accessibilityHelperLineAtIndex:(int)accessibilityIndex {
return [_dataSource getLineAtIndex:[self accessibilityHelperLineNumberForAccessibilityLineNumber:accessibilityIndex]];
}
Loading
Loading
Loading
Loading
@@ -42,6 +42,9 @@
// Returns the contents of selected text in accessibility-space only.
- (NSString *)accessibilityHelperSelectedText;
 
// Returns the URL of the current document
- (NSURL *)accessibilityHelperCurrentDocumentURL;
@end
 
// This outsources accessibilty methods for PTYTextView. It's useful to keep
Loading
Loading
Loading
Loading
@@ -334,6 +334,10 @@
return [NSValue valueWithRange:NSMakeRange(0, [[self allText] length])];
}
 
- (NSURL *)currentDocumentURL {
return [_delegate accessibilityHelperCurrentDocumentURL];
}
#pragma mark - Setters
 
- (void)setSelectedTextRange:(NSRange)range {
Loading
Loading
@@ -362,7 +366,8 @@
NSAccessibilitySelectedTextRangeAttribute,
NSAccessibilitySelectedTextRangesAttribute,
NSAccessibilityInsertionPointLineNumberAttribute,
NSAccessibilityVisibleCharacterRangeAttribute ];
NSAccessibilityVisibleCharacterRangeAttribute,
NSAccessibilityDocumentAttribute ];
}
 
- (NSArray *)accessibilityParameterizedAttributeNames {
Loading
Loading
@@ -454,6 +459,8 @@
return [self insertionPointLineNumber];
} else if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) {
return [self visibleCharacterRange];
} else if ([attribute isEqualToString:NSAccessibilityDocumentAttribute]) {
return [[self currentDocumentURL] absoluteString];
} else {
if (handled) {
*handled = NO;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment