From 422e014effbf1b427e055e10dafdec7cd08f1db4 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Fri, 16 Sep 2016 18:32:14 +0200 Subject: [PATCH] fixed ^a and ^e semantics --- AppKit/CPTextView/CPTextView.j | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index a5a7d7171..76d56ada8 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1170,8 +1170,14 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)moveToEndOfParagraph:(id)sender { - if ([self isSelectable]) + if (![self isSelectable]) + return; + + if (!_isNewlineCharacter([[_textStorage string] characterAtIndex:_selectionRange.location])) [self _moveSelectionIntoDirection:1 granularity:CPSelectByParagraph]; + + if (_isNewlineCharacter([[_textStorage string] characterAtIndex:MAX(0, _selectionRange.location - 1)])) + [self moveLeft:sender]; } - (void)moveToEndOfParagraphAndModifySelection:(id)sender @@ -1244,7 +1250,10 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)moveToBeginningOfParagraph:(id)sender { - if ([self isSelectable]) + if (![self isSelectable]) + return; + + if (!_isNewlineCharacter([[_textStorage string] characterAtIndex:MAX(0, _selectionRange.location - 1)])) [self _moveSelectionIntoDirection:-1 granularity:CPSelectByParagraph]; }