2015-09-13 Fred Kiefer <FredKiefer@gmx.de>

* Source/NSTextView.m: Invalidate insertion point timer in
        dealloc.
        * Source/NSToolbarItem.m: Check for drawing rect within bounds
        before drawing toolbar item.
        Patch by Marcian Lytwyn <gna@advcsi.com>.

2015-09-10  Doug Simons <doug.simons@testplant.com> and Paul Landers
<paul.landers@testplant.com>

        * Source/NSLayoutManager.m: Fix a bug that would try to adjust
        the length of the selected range to a negative number, leading
        to an exception and eventual crashes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38986 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2015-09-13 21:36:40 +00:00
parent 7a251b66ec
commit ff61d4c642
4 changed files with 54 additions and 30 deletions

View file

@ -1,3 +1,17 @@
2015-09-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m: Invalidate insertion point timer in
dealloc.
* Source/NSToolbarItem.m: Check for drawing rect within bounds
before drawing toolbar item.
Patch by Marcian Lytwyn <gna@advcsi.com>.
2015-09-10 Doug Simons <doug.simons@testplant.com> and Paul Landers <paul.landers@testplant.com>
* Source/NSLayoutManager.m: Fix a bug that would try to adjust
the length of the selected range to a negative number, leading
to an exception and eventual crashes.
2015-08-28 Riccardo Mottola <rm@gnu.org>
* Source/NSView.m
@ -6,7 +20,8 @@
* Headers/AppKit/NSWindow.h
* Source/NSWindow.m
Constants and methods for Exposé and other features we don't have and perhaps never will
Constants and methods for Exposé and other features we don't have
and perhaps never will.
2015-08-26 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -2915,7 +2915,7 @@ no_soft_invalidation:
(of selection, wrt range, before change)
--------------------------
after after location += lengthChange;
in after length = NSMaxRange(sel)-NSMaxRange(range)-lengthChange; location=NSMaxRange(range);
in after length = NSMaxRange(sel)-(NSMaxRange(range)-lengthChange); location=NSMaxRange(range);
in in length = 0; location=NSMaxRange(range);
before after length += lengthChange;
before in length = range.location-location;
@ -2937,7 +2937,7 @@ no_soft_invalidation:
{
if (NSMaxRange(_selected_range) > NSMaxRange(range) - lengthChange)
{ /* in after */
newRange.length = NSMaxRange(_selected_range) - NSMaxRange(range) - lengthChange;
newRange.length = NSMaxRange(_selected_range) - (NSMaxRange(range) - lengthChange);
newRange.location = NSMaxRange(range);
}
else
@ -2958,6 +2958,12 @@ no_soft_invalidation:
{ /* before before */
}
/* sanity check */
if (NSMaxRange(newRange) > [_textStorage length])
{
newRange = NSMakeRange(MIN(range.location, [_textStorage length]), 0);
}
/* If there are text views attached to us, let them handle the
change. */
if ([self firstTextView])

View file

@ -141,6 +141,8 @@ Interface for a bunch of internal methods that need to be cleaned up.
* Used to implement the blinking insertion point
*/
- (void) _blink: (NSTimer *)t;
- (void) _stopInsertionTimer;
- (void) _startInsertionTimer;
/*
* these NSLayoutManager- like method is here only informally
@ -1118,6 +1120,7 @@ that makes decoding and encoding compatible with the old code.
name: NSTextDidChangeNotification
object: self];
[_textCheckingTimer invalidate];
[self _stopInsertionTimer];
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_updateState:)
target: self
@ -4178,32 +4181,6 @@ Figure out how the additional layout stuff is supposed to work.
return nil;
}
- (void) _stopInsertionTimer
{
if (_insertionPointTimer != nil)
{
[_insertionPointTimer invalidate];
DESTROY(_insertionPointTimer);
}
}
- (void) _startInsertionTimer
{
if (_insertionPointTimer != nil)
{
NSWarnMLog(@"Starting insertion timer with existing one running");
[self _stopInsertionTimer];
}
_insertionPointTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(_blink:)
userInfo: nil
repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: _insertionPointTimer
forMode: NSModalPanelRunLoopMode];
RETAIN(_insertionPointTimer);
}
- (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag
{
NSRect new;
@ -6167,6 +6144,32 @@ or add guards
[self displayIfNeeded];
}
- (void) _stopInsertionTimer
{
if (_insertionPointTimer != nil)
{
[_insertionPointTimer invalidate];
DESTROY(_insertionPointTimer);
}
}
- (void) _startInsertionTimer
{
if (_insertionPointTimer != nil)
{
NSWarnMLog(@"Starting insertion timer with existing one running");
[self _stopInsertionTimer];
}
_insertionPointTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(_blink:)
userInfo: nil
repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: _insertionPointTimer
forMode: NSModalPanelRunLoopMode];
RETAIN(_insertionPointTimer);
}
- (NSRect) rectForCharacterRange: (NSRange)aRange
{
NSRange glyphRange;

View file

@ -536,7 +536,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) drawRect: (NSRect)rect
{
if (_showLabel)
if (_showLabel && NSIntersectsRect(rect, [self bounds]))
{
NSAttributedString *attrString;
NSDictionary *attr;