From 5f0ddeedd07c62799aef2cd4de0f5fb5968be06f Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sun, 17 May 2015 20:43:18 +0200 Subject: [PATCH] draw caret permantently during editing... ...or cursor navigation --- AppKit/CPTextView/CPTextView.j | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index bd0b876c0..831fcf375 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -676,6 +676,13 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)keyDown:(CPEvent)event { [self interpretKeyEvents:[event]]; + [_caret setPermanentlyVisible:YES]; +} + +- (void)keyUp:(CPEvent)event +{ + [super keyUp:event]; + [_caret setPermanentlyVisible:NO]; } @@ -1890,6 +1897,7 @@ var CPTextViewAllowsUndoKey = @"CPTextViewAllowsUndoKey", @implementation _CPCaret : CPObject { BOOL _drawCaret; + BOOL _permanentlyVisible @accessors(property=permanentlyVisible); CGRect _rect; CPTextView _textView; CPTimer _caretTimer; @@ -1946,7 +1954,7 @@ var CPTextViewAllowsUndoKey = @"CPTextViewAllowsUndoKey", - (void)_blinkCaret:(CPTimer)aTimer { - _drawCaret = !_drawCaret; + _drawCaret = (!_drawCaret) || _permanentlyVisible; [_textView setNeedsDisplayInRect:_rect]; }