Permalink
Browse files

Better command return

  • Loading branch information...
1 parent 23e2161 commit 36c80e175bfdbc373f73ceca66d3578aebc87880 @elasticthreads elasticthreads committed Aug 16, 2011
Showing with 3 additions and 18 deletions.
  1. +0 −1 LinkingEditor.h
  2. +3 −17 LinkingEditor.m
View
1 LinkingEditor.h
@@ -82,7 +82,6 @@
- (void)switchFindPanelDelegate;
- (IBAction)findInFullscreen;
- (IBAction)insertLink:(id)sender;
-- (void)cmdReturn;
//
@end
View
20 LinkingEditor.m
@@ -825,8 +825,9 @@ - (void)keyDown:(NSEvent*)anEvent {
//maybe it works on someone else's 10.3 Mac
[self doCommandBySelector:@selector(insertBacktab:)];
return;
- }else if (([anEvent keyCode]==36)&&([anEvent modifierFlags]&NSCommandKeyMask)&&(!(([anEvent modifierFlags]&NSControlKeyMask)||([anEvent modifierFlags]&NSAlternateKeyMask)||([anEvent modifierFlags]&NSShiftKeyMask)))) {
- [self cmdReturn];
+ }else if (([anEvent keyCode]==36)&&([anEvent modifierFlags]&NSCommandKeyMask)&&(!(([anEvent modifierFlags]&NSControlKeyMask)||([anEvent modifierFlags]&NSAlternateKeyMask)||([anEvent modifierFlags]&NSShiftKeyMask)))) {
+ [self moveToEndOfParagraph:self];
+ [self insertNewlineIgnoringFieldEditor:self];
return;
}
@@ -1633,21 +1634,6 @@ - (void)dealloc {
//elasticwork
-- (void)cmdReturn{
- NSRange selRange = [self selectedRange];
- NSString *postStr=[[self string] substringFromIndex:selRange.location];
- const unichar newL = NSNewlineCharacter;
- NSString *nwLn=[NSString stringWithCharacters:&newL length:1];
- NSRange pRange = [postStr rangeOfString:nwLn];
- pRange.length=0;
- if (pRange.location==NSNotFound) {
- pRange.location=[self string].length;
- }else{
- pRange.location+=selRange.location;
- }
- [self setSelectedRange:pRange];
- [super insertNewlineIgnoringFieldEditor:self];
-}
- (IBAction)insertLink:(id)sender{
if ([[self window] firstResponder]!=self) {

0 comments on commit 36c80e1

Please sign in to comment.