bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix: NSTextView.m, -setSelectedRange:...


From: Georg Fleischmann
Subject: Fix: NSTextView.m, -setSelectedRange:...
Date: Sun, 12 Aug 2001 19:32:11 +0200

Hi,

here is a little fix for NSTextView. The patch does two things:

First, it prevents NSTextView from asking the text storage for attributes, if  
the length of the text storage is zero.

Then, NSTextView checks if the text storage returned any attributes at all,  
before setting them. This is to keep the default attributes.
In my case a string was set by using [NSTextView -setString:]. This sets the  
string in the NSTextStorage without attributes! In this case NSTextView should  
use default attributes like OpenStep does.

Georg


2001-08-12  Georg Fleischmann

        * gui/Source/NSTextView.m
        [NSTextView setSelectedRange:affinity:stillSelecting:]:
        use default attributes, if text storage provides no attributes

diff -u gui/Source/NSTextView.m.orig gui/Source/NSTextView.m


--- gui/Source/NSTextView.m.orig        Sat Aug  4 04:30:34 2001
+++ gui/Source/NSTextView.m     Sun Aug 12 18:46:08 2001
@@ -1340,7 +1340,7 @@
        }
       else  /* no selection, only insertion point */
        {
-         if (_tf.is_rich_text)
+         if (_tf.is_rich_text && [_textStorage length])
            {
              NSDictionary *dict;
        
@@ -1360,7 +1360,8 @@
                  dict = [_textStorage attributesAtIndex: range.location
                                       effectiveRange: NULL];
                }
-             [self setTypingAttributes: dict];
+             if ([dict count])
+               [self setTypingAttributes: dict];
            }
        }
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]