File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,10 +77,22 @@ - (void) textStorageDidChange:(NSNotification *)noti {
7777 // Set cursor before the inserted documentation. So we can use tab to begin edit.
7878 int baseIndentationLength = (int )[doc baseIndentation ].length ;
7979 [textView setSelectedRange: NSMakeRange (currentLineResult.range.location + baseIndentationLength, 0 )];
80+
81+ // Send a 'tab' after insert the doc. For our lazy programmers. :)
82+ [self sendTabEvent ];
8083 }
8184 }
8285 }
8386}
8487
88+ -(void ) sendTabEvent
89+ {
90+ CGEventSourceRef src = CGEventSourceCreate (kCGEventSourceStateHIDSystemState );
91+ // kVK_Tab = 0x30, See http://forums.macrumors.com/archive/index.php/t-1216916.html
92+ CGEventRef tab = CGEventCreateKeyboardEvent (src, 0x30 , true );
93+ CGEventTapLocation loc = kCGHIDEventTap ;
94+ CGEventPost (loc, tab);
95+ CFRelease (tab);
96+ }
8597
8698@end
You can’t perform that action at this time.
0 commit comments