Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set keyboard focus reasonably when switching between views.

When you switch to the commit view, the commit message gets focus;
when you switch to the history view, the commit list gets focus.
  • Loading branch information...
commit f2a37df9f5cd16057b505e273882e8f836f500d2 1 parent 7baf854
Nicholas Riley nriley authored committed
4 PBGitCommitController.m
View
@@ -47,6 +47,10 @@ - (void) removeView
[webController closeView];
[super finalize];
}
+- (NSResponder *)firstResponder;
+{
+ return commitMessageView;
+}
- (IBAction)signOff:(id)sender
{
5 PBGitHistoryController.m
View
@@ -179,6 +179,11 @@ - (void) updateView
[self refresh:nil];
}
+- (NSResponder *)firstResponder;
+{
+ return commitList;
+}
+
- (void) selectCommit: (NSString*) commit
{
NSPredicate* selection = [NSPredicate predicateWithFormat:@"realSha == %@", commit];
1  PBGitWindowController.m
View
@@ -100,6 +100,7 @@ - (void)changeViewController:(NSInteger)whichViewTag
[self setNextResponder: viewController];
[self didChangeValueForKey:@"viewController"]; // this will trigger the NSTextField's value binding to change
+ [[self window] makeFirstResponder:[viewController firstResponder]];
}
- (void)awakeFromNib
2  PBViewController.h
View
@@ -23,4 +23,6 @@
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller;
- (void) removeView;
- (void) updateView;
+- (NSResponder *)firstResponder;
+
@end
5 PBViewController.m
View
@@ -40,4 +40,9 @@ - (void) awakeFromNib
- (void) updateView
{
}
+
+- (NSResponder *)firstResponder;
+{
+ return nil;
+}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.