Author: fredkiefer
Date: Sun Sep 13 23:36:40 2015
New Revision: 38986

URL: http://svn.gna.org/viewcvs/gnustep?rev=38986&view=rev
Log:
2015-09-13 Fred Kiefer <[email protected]>

        * 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 <[email protected]>.

2015-09-10  Doug Simons <[email protected]> and Paul Landers
<[email protected]>

        * 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.

Modified:
    libs/gui/trunk/ChangeLog
    libs/gui/trunk/Source/NSLayoutManager.m
    libs/gui/trunk/Source/NSTextView.m
    libs/gui/trunk/Source/NSToolbarItem.m

Modified: libs/gui/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=38986&r1=38985&r2=38986&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog    (original)
+++ libs/gui/trunk/ChangeLog    Sun Sep 13 23:36:40 2015
@@ -1,3 +1,17 @@
+2015-09-13 Fred Kiefer <[email protected]>
+
+       * 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 <[email protected]>.
+
+2015-09-10  Doug Simons <[email protected]> and Paul Landers 
<[email protected]>
+
+       * 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 <[email protected]>
 
        * 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 <[email protected]>
 

Modified: libs/gui/trunk/Source/NSLayoutManager.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSLayoutManager.m?rev=38986&r1=38985&r2=38986&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSLayoutManager.m     (original)
+++ libs/gui/trunk/Source/NSLayoutManager.m     Sun Sep 13 23:36:40 2015
@@ -2915,7 +2915,7 @@
 (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 @@
        {
          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
@@ -2957,6 +2957,12 @@
       else
        { /* 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. */

Modified: libs/gui/trunk/Source/NSTextView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSTextView.m?rev=38986&r1=38985&r2=38986&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSTextView.m  (original)
+++ libs/gui/trunk/Source/NSTextView.m  Sun Sep 13 23:36:40 2015
@@ -141,6 +141,8 @@
  * 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 @@
     name: NSTextDidChangeNotification
     object: self];
   [_textCheckingTimer invalidate];
+  [self _stopInsertionTimer];
 
   [[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_updateState:)
     target: self
@@ -4178,32 +4181,6 @@
   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;
@@ -6165,6 +6142,32 @@
      event processing in the gui runloop, we need to manually update
      the window.  */
   [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

Modified: libs/gui/trunk/Source/NSToolbarItem.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSToolbarItem.m?rev=38986&r1=38985&r2=38986&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSToolbarItem.m       (original)
+++ libs/gui/trunk/Source/NSToolbarItem.m       Sun Sep 13 23:36:40 2015
@@ -536,7 +536,7 @@
 
 - (void) drawRect: (NSRect)rect
 {  
-  if (_showLabel)
+  if (_showLabel && NSIntersectsRect(rect, [self bounds]))
     {
       NSAttributedString *attrString;
       NSDictionary *attr;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to