Re: NSTextView tab stop count

2016-10-15 Thread tridiak
Ok. Your code works. I think the reason I couldn’t get it to work is when I was using [textView insertText:mas], causing my settings to be overridden. Thanks for help. > On 15/10/2016, at 12:22 PM, Shane Stanley wrote: > > On 15 Oct. 2016, at 12:43 am, tridiak wrote: >> >> This works up to 12

Re: NSTextView tab stop count

2016-10-14 Thread Shane Stanley
On 15 Oct. 2016, at 12:43 am, tridiak wrote: > > This works up to 12. Above that, it sticks to 12. Are you sure you're just not seeing them because the text in some columns is longer than you tab width? I just made a simple example with this: NSMutableAttributedString *mas = [[NSMutableA

Re: NSTextView tab stop count

2016-10-14 Thread Jens Alfke
> On Oct 14, 2016, at 6:43 AM, tridiak wrote: > > How does Xcode & Text Wrangler pull it off? Xcode pretty heavily customizes the Cocoa text engine; even back in the ProjectBuilder days they had a bunch of custom editing subclasses. I wouldn’t be surprised if they implement their own tabbing

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Felipe Monteiro de Carvalho
Hello, Sorry for the noise, it turns out that the bug was in my software after all! thanks, -- Felipe Monteiro de Carvalho ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Con

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Jens Alfke
> On Sep 27, 2016, at 2:07 AM, Graham Cox wrote: > > Are you sure about that? I’ve never seen the text view add line endings to > the underlying raw text - that’s just not how text layout works. +1. I’ve been using NSTextView since 2001 and I know for a fact that it doesn’t insert meta-charac

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 7:28 PM, Felipe Monteiro de Carvalho > wrote: > > By the way, not sure if this makes a difference, but the original text > was added via NSTextView.string > > It is not text inputted by the user. > Well, a NSTextView can’t have a string unless it came from somewhere, the

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 7:26 PM, Felipe Monteiro de Carvalho > wrote: > > But to be sure I will test the same thing as you are testing, you are > reading the text via NSTextView.string ? Yes. I set up a very simple situation where the NSTextView’s delegate simply logs the textView.string as I t

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Felipe Monteiro de Carvalho
On Tue, Sep 27, 2016 at 11:26 AM, Felipe Monteiro de Carvalho wrote: > But to be sure I will test the same thing as you are testing, you are > reading the text via NSTextView.string ? By the way, not sure if this makes a difference, but the original text was added via NSTextView.string It is not

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Felipe Monteiro de Carvalho
On Tue, Sep 27, 2016 at 11:07 AM, Graham Cox wrote: > Are you sure about that? I’ve never seen the text view add line endings to > the underlying raw text - that’s just not how text layout works. > (Indeed I just made a quick test case and I don’t see that happening). What I am writing is a larg

Re: NSTextView read real text content (without 0xA added by wordwrap)

2016-09-27 Thread Graham Cox
> On 27 Sep 2016, at 5:31 PM, Felipe Monteiro de Carvalho > wrote: > > But the resulting string contains line endings which are added in the > places where the word-wrap takes places, and I need the raw text, > without such added line endings. Are you sure about that? I’ve never seen the text

Re: NSTextView pagination

2016-07-07 Thread Graham Cox
> On 8 Jul 2016, at 2:42 AM, Jonathan Mitchell wrote: > > could supply a new view that would correspond to the new page orientation (if > I could get an appropriate notification) but NSPrintOperation’s -view > is readonly. Do it this way. The textview can share the same NSTextStorage a

Re: NSTextView Question

2015-09-08 Thread Dave
Brilliant! Just what I wanted - did the trick wonderfully, thanks again, I would never have thought to look in the Size Panel. BTW, the code is needed, e.g. self.pDetailTextView.textContainer.containerSize = NSMakeSize(FLT_MAX, FLT_MAX); self.pDetailTextView.textContainer.widthTracksTextView =

Re: NSTextView Question

2015-09-08 Thread Ken Thomases
On Sep 8, 2015, at 9:22 AM, Dave wrote: > I’ve got an NSTextView that’s working in that it Scrolls ok vertically, but > If I have a long line, it wraps instead of clipping the line and allowing > Horizontal Scrolling. I’ve looked at the properties of the ScrollView and the > underlying TextVie

Re: NSTextView Question

2015-09-08 Thread Dave
Hi, Having thought about it a bit more, I think I understand, the problem was that the data I wish to display has two types of data embedded in it. The first type is more of a NSTextView in that it should wrap as necessary as the Text Box Frame changes size and another type that is a list, e.g.

Re: NSTextView Copy-and-Paste Problem

2015-03-02 Thread Charles Jenkins
Thanks, Martin. The docs say you can put anything you want into the attributes dictionary—without mentioning that cutting and pasting will screw it all up. But it makes sense why, if cutting and pasting involves a translation into some non-native format. I’ll try to learn how to override cuttin

Re: NSTextView Copy-and-Paste Problem

2015-03-02 Thread Martin Wierschin
> I’m having problems with text attributes getting mangled by copy-and-paste > operations within the selfsame text view. Obviously text pasted in from > outside the app would have an unpredictable set of attributes, but you’d > think copying and pasting in the same text view would leave you with

Re: NSTextView Copy-and-Paste Problem

2015-03-02 Thread Charles Jenkins
Can I convince anyone to look at my demo app and tell me what if anything I'm doing wrong? I can hardly believe copying and pasting in a text view would lose or replace attributes like this . . . seems like a very serious bug someone would have noticed long before me. --  Charles On February

Re: NSTextView and Syntax Highlighting

2014-12-20 Thread Charles Jenkins
Martin, Ecir, and Quincey: Thank you all! All three answers turned out to be helpful. (Quincey, you led me to learn about how to get attributed substrings, should I ever need to do it.) Martin, your chief difference from my code seems be calling the layout manager’s ensureGlyphsForCharacterRa

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Martin Hewitson
I’m using temporary attributes for TeXnicle (LaTeX editor), but as others have said, it doesn’t work if you need bold etc. Anyway, you can see the source at github: https://github.com/martinhewitson/TeXnicle You need to look in TeXnicle/TeXnicle/TeXEditor/TextView/TeXColoringEngine.m Origina

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread ecir hana
On Fri, Dec 19, 2014 at 6:58 PM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Dec 19, 2014, at 05:36 , Charles Jenkins wrote: > > > > Could it be that even though the layout manager's temporary attributes > are designed for purposes like syntax highlighting, folks don't actua

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Quincey Morris
On Dec 19, 2014, at 05:36 , Charles Jenkins wrote: > > Could it be that even though the layout manager's temporary attributes are > designed for purposes like syntax highlighting, folks don't actually use them > because they don't work right during edits? I tried to use them once for underli

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Charles Jenkins
So I used DuckDuckGo to find "NSText syntax highlight," which led me to Uli Kusterer's site where there an example syntax highlighting document project. If I'm reading the code right, it appears Uli builds a new attributed string with text colors and uses that to replace the original edited ra

Re: NSTextView scroll to attribute/bookmark?

2014-08-24 Thread Ken Thomases
On Aug 24, 2014, at 1:05 AM, Samuel Williams wrote: > I'm generating a NSAttributedString which looks like the following: > > function_name_1 > disassembled code output > disassembled code output > disassembled code output > function_name_2 > disassembled code output > disassembled code output

Re: NSTextView Text Length

2014-04-15 Thread Gordon Apple
Ah. Somehow, I totally missed the fact that NSText has its own delegate protocol. That did it. Thanks. On 4/15/14 7:20 PM, "Graham Cox" wrote: > > On 16 Apr 2014, at 9:57 am, Gordon Apple wrote: > >> > Is there any way to get a notification or set an observer on NSTextView¹s >> > used text

Re: NSTextView Text Length

2014-04-15 Thread Graham Cox
On 16 Apr 2014, at 9:57 am, Gordon Apple wrote: > Is there any way to get a notification or set an observer on NSTextView¹s > used text length? After much research, I have not found a way other than to > pole the layout manager for usedRectForTextContainer. The delegate is sent -textDidChange

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread Shane Stanley
On 13 Nov 2013, at 4:08 AM, 2551 <2551p...@gmail.com> wrote: > I’ve put this one to bed and can now move on to the next probl Here's the answer already: setAutomaticDashSubstitutionEnabled:NO. -- Shane Stanley ___ Cocoa-dev mailing list (Cocoa-d

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread Graham Cox
On 12 Nov 2013, at 5:51 pm, 2551 <2551p...@gmail.com> wrote: > Thanks, understood. However, I probably didn’t make it clear that I actually > need to do both. i.e., remove the quote formatting AND set a particular > default font and color. Yep, I got that. > Still not sure how to go about do

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread 2551
On 12 Nov 2013, at 23:51, 2551 <2551p...@gmail.com> wrote: > Still not sure how to go about doing the latter > Scratch that. Light bulb went on. Got it! Thanks muchly. I’ve put this one to bed and can now move on to the next probl…ahem…*stage* of development. :p _

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread 2551
On 12 Nov 2013, at 23:25, Graham Cox wrote: > > This sounds like the smart quote substitution feature, which has nothing to > do with the font or other text attributes. Thanks, understood. However, I probably didn’t make it clear that I actually need to do both. i.e., remove the quote form

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread 2551
Thanks Graham and Mark. Candle out, torch on (with fresh batteries). :) P On 12 Nov 2013, at 23:25, Graham Cox wrote: > > On 12 Nov 2013, at 4:19 pm, 2551 <2551p...@gmail.com> wrote: > >> I’m confused. If you select a NSTextView item in IB, then examine the >> Attributes Inspector, you

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread Graham Cox
On 12 Nov 2013, at 4:19 pm, 2551 <2551p...@gmail.com> wrote: > I’m confused. If you select a NSTextView item in IB, then examine the > Attributes Inspector, you’re presented with various options for setting text > attributes, such as the font, size and color. In my clumsy hands, none of > thes

Re: NSTextView - stopping conversion of quotation marks

2013-11-12 Thread Mark Munz
Use [myTextView setAutomaticQuoteSubstitutionEnabled:NO]; to disable to automatic conversion of plain quotes to smart quotes. On Tue, Nov 12, 2013 at 7:19 AM, 2551 <2551p...@gmail.com> wrote: > I’m confused. If you select a NSTextView item in IB, then examine the > Attributes Inspector, you’re

Re: NSTextView without word wrap

2013-10-16 Thread Jens Alfke
On Oct 16, 2013, at 5:33 AM, Mark Wright wrote: > Shouldn't that be: > > - (BOOL) wrapsLines { > return ![self isHorizontallyResizable]; > } You’re right — I think I never noticed this bug because I never called the getter; I only added it so the compiler would let me declare wrapsLines as

Re: NSTextView without word wrap

2013-10-16 Thread Mark Wright
Shouldn't that be: - (BOOL) wrapsLines { return ![self isHorizontallyResizable]; } Otherwise if you set it to YES the getter will return NO because of the [self setHorizontallyResizable: !wraps] line in the setter? On 16 Oct 2013, at 06:55, Jens Alfke wrote: > > On Oct 12, 2013, at 2:4

Re: NSTextView without word wrap

2013-10-16 Thread Mikael Hakman
Works as advertised. Many thanks. /Mikael On Oct 16, 2013, at 7:55 AM, Jens Alfke wrote: > > On Oct 12, 2013, at 2:42 PM, Mikael Hakman wrote: > >> How can I make NSTextView not to do word wrap? Thanks. > > Basically you have to make the view’s text container infinitely wide. Here’s > an i

Re: NSTextView without word wrap

2013-10-15 Thread Jens Alfke
On Oct 12, 2013, at 2:42 PM, Mikael Hakman wrote: > How can I make NSTextView not to do word wrap? Thanks. Basically you have to make the view’s text container infinitely wide. Here’s an implementation of a .wrapsLines property that I used in a subclass of NSTextView a few years ago. - (BOOL

Re: NSTextView with irregular shape

2013-02-14 Thread Vyacheslav Karamov
I want the same text view as Apple iMessages has. I have such bullet image and I plan to use it as textview's shape. Actually this one http://i.piccy.info/i7/e52f246522784139d1c75bf53bb466e6/4-55-1897/58781878/iMessages.png 14.02.2013 22:18, Kyle Sluder пишет: On Thu, Feb 14, 2013, at 12:00 P

Re: NSTextView with irregular shape

2013-02-14 Thread Kyle Sluder
On Thu, Feb 14, 2013, at 12:00 PM, Vyacheslav Karamov wrote: > I know how to implement custom text layout. Good example of this I have > found in "Cocoa Programming Developer's Handbook" by David Chisnall. > This book gives an example how to implement custo text layout, but I > don't understand

Re: NSTextView with irregular shape

2013-02-14 Thread Vyacheslav Karamov
I know how to implement custom text layout. Good example of this I have found in "Cocoa Programming Developer's Handbook" by David Chisnall. This book gives an example how to implement custo text layout, but I don't understand how to implement custom shape of NSTextView. Because my widget grow

Re: NSTextView with irregular shape

2013-02-14 Thread Vyacheslav Karamov
No, I have already implemented bubbles. It is just NSTableView descendant. 14.02.2013 19:13, Kyle Sluder пишет: On Feb 14, 2013, at 3:11 AM, Vyacheslav Karamov wrote: Hello All! I need to implement NSTextView descendant similar to one used in Mac iMessages App. I have implemented live resi

Re: NSTextView with irregular shape

2013-02-14 Thread Kyle Sluder
On Feb 14, 2013, at 3:11 AM, Vyacheslav Karamov wrote: > Hello All! > > I need to implement NSTextView descendant similar to one used in Mac > iMessages App. > I have implemented live resizing, but how to set resizable image as its > custom shape? Messages doesn't use custom-shaped text views

Re: NSTextView with irregular shape

2013-02-14 Thread Keary Suska
On Feb 14, 2013, at 4:11 AM, Vyacheslav Karamov wrote: > I need to implement NSTextView descendant similar to one used in Mac > iMessages App. > I have implemented live resizing, but how to set resizable image as its > custom shape? AFAIK, custom text box geometry is really a function of NSText

Re: NSTextView paste:

2012-08-15 Thread ecir hana
On Tue, Aug 14, 2012 at 2:43 AM, Seth Willits wrote: > > - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString > *)type > { > if ([type isEqual:NSStringPboardType]) { > if ([[pboard stringForType:type] isEqual:@"foo"]) { > NSRang

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 3:55 PM, ecir hana wrote: > Thank you for the reply! Unfortunately, there seem to be a tiny bug with > undo. My textview has "setRichText:" set to NO so that it triggers the first > condition. When the textview looks like this: > > aaa > bbb > > and I select and copy "aaa",

Re: NSTextView paste:

2012-08-13 Thread Graham Cox
On 14/08/2012, at 3:54 AM, ecir hana wrote: > Please, does anyone know how to approach this? You don't need to do anything, AFAICS. NSTextView supports -paste: and will do the right thing internally. You only have to ensure it's first responder at the time you want to paste. --Graham __

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Tue, Aug 14, 2012 at 12:55 AM, ecir hana wrote: > > > > aaa > bbb > > > I mean: foo foo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev

Re: NSTextView paste:

2012-08-13 Thread ecir hana
On Mon, Aug 13, 2012 at 11:45 PM, Seth Willits wrote: > > > - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString > *)type > { > if ([type isEqual:NSStringPboardType]) { > if ([[pboard stringForType:type] isEqual:@"foo"]) { > [se

Re: NSTextView paste:

2012-08-13 Thread Seth Willits
On Aug 13, 2012, at 10:54 AM, ecir hana wrote: > I have a NSTextView, where the user can paste plain text into. > > When the users has "foo" in the pasteboard I would like "bar" to be pasted. > In other words, a user goes to, say, a web browser, selects "foo", cmd+c, > switches to my NSTextView,

Re: NSTextView scrolling

2012-07-31 Thread ecir hana
On Tue, Jul 31, 2012 at 6:19 AM, Richard Somers wrote: > > This might help. > > > http://www.cocoabuilder.com/archive/cocoa/145464-nstextview-auto-scroll-up-behaviour.html > > Thanks for the reply! However, it does not seem to work - it still scrolls half-page up/down, even if I change the "margin

Re: NSTextView scrolling

2012-07-30 Thread Richard Somers
On Jul 30, 2012, at 12:19 PM, ecir hana wrote: > when jumping from line to line in a textview with "up" and "down" keys, it > exhibits this scrolling behavior - when the cursor is at the very top and I > hit "up" (and vice versa), it scrolls the document half page up, that is, > the current line i

Re: NSTextView scrolls to top when text storage changes

2012-07-06 Thread Martin Hewitson
OK, I found the problem. Turns out I had left the textview associated with more than one textstorage. I'm surprised that this was the only symptom. In detail, when switching tabs in the editor, I forgot to remove the textview from all other text containers before assigning it to the file associa

Re: NSTextView with ruler controls in a NSPopover

2012-07-02 Thread Graham Cox
On 03/07/2012, at 3:32 PM, Graham Cox wrote: > I'm trying to put a text editor into a popover. Never mind - turns out this is a bad idea anyway. Because the text ruler controls can bring up secondary sheets for the various "Other..." menu items, it all collapses in a heap because NSPopover is

Re: NSTextView

2012-06-07 Thread ecir hana
On Thu, Jun 7, 2012 at 5:47 AM, koko wrote: > On an NSTextView I call -selectAll: and then -insertText: > > This scrolls the view to the end of the text. > > How would I scroll the view to the top of the text? > Just before the insertText: get the current scroll position and then restore it: ht

Re: NSTextView

2012-06-06 Thread Graham Cox
On 07/06/2012, at 2:00 PM, koko wrote: > Got it … > >[m_clipView scrollToPoint:m_origin]; >[m_scrollView reflectScrolledClipView:m_clipView]; No you haven't. Look at what NSTextView inherits. Actually, there is a method in NSText which is more direct - [NSText scrollRangeToVisib

Re: NSTextView

2012-06-06 Thread koko
Got it … [m_clipView scrollToPoint:m_origin]; [m_scrollView reflectScrolledClipView:m_clipView]; -koko On Jun 6, 2012, at 9:47 PM, koko wrote: > On an NSTextView I call -selectAll: and then -insertText: > > This scrolls the view to the end of the text. > > How would I scroll the view

Re: NSTextView

2012-06-06 Thread Graham Cox
On 07/06/2012, at 1:47 PM, koko wrote: > How would I scroll the view to the top of the text? [NSView scrollToPoint:]; --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the

Re: NSTextView selection

2012-06-04 Thread Jens Alfke
On Jun 4, 2012, at 10:10 AM, ecir hana wrote: > I have a NSTextView and when I select all the text, all the lines get > highlighted from left to right margin, except the last line which is > highlighted from left margin to the last character on line. Please, is it > possible to highlight the last

Re: NSTextView selection

2012-06-04 Thread Charlie Dickman
You can use an NSTextView delegate and NSFormatters to adjust the selection as it is being made. On Jun 4, 2012, at 1:10 PM, ecir hana wrote: > Hello, > > I have a NSTextView and when I select all the text, all the lines get > highlighted from left to right margin, except the last line which is

Re: NSTextView selection

2012-06-04 Thread Kyle Sluder
On Jun 4, 2012, at 10:10 AM, ecir hana wrote: > Hello, > > I have a NSTextView and when I select all the text, all the lines get > highlighted from left to right margin, except the last line which is > highlighted from left margin to the last character on line. Please, is it > possible to highli

Re: NSTextView row number

2012-05-22 Thread Jens Alfke
On May 22, 2012, at 3:14 PM, ecir hana wrote: > I have a NSTextView and would like to keep track of where the cursor is in > terms of a line number. Please, is there a way to figure this out somehow > (akin ti lineRangeForRange:) or do I have to calculate it myself, e.g. by > caching newlines loc

Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Jim McGowan
On 23 Feb 2012, at 08:31, Conrad Shultz wrote: > On 2/19/12 9:29 PM, Jim McGowan wrote: >> Hi, >> >> I have an NSTextView subclass and I need it to inform another object >> of when it becomes first responder - along the lines of overriding >> -becomeFirstResponder something along the lines of th

Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Jim McGowan
On 23 Feb 2012, at 05:47, Kyle Sluder wrote: > On Sun, Feb 19, 2012 at 9:29 PM, Jim McGowan wrote: >> However, I'm a bit confused by the docs. -becomeFirstResponder is marked as >> being deprecated for NSTextView, but not deprecated in its superclass >> NSResponder. The NSTextView docs for t

Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Conrad Shultz
On 2/19/12 9:29 PM, Jim McGowan wrote: > Hi, > > I have an NSTextView subclass and I need it to inform another object > of when it becomes first responder - along the lines of overriding > -becomeFirstResponder something along the lines of this: Subclassing seems like too much of a sledgehammer.

Re: NSTextView and -becomeFirstResponder

2012-02-22 Thread Kyle Sluder
On Sun, Feb 19, 2012 at 9:29 PM, Jim McGowan wrote: > However, I'm a bit confused by the docs.  -becomeFirstResponder is marked as > being deprecated for NSTextView, but not deprecated in its superclass > NSResponder.  The NSTextView docs for this method reads: > > "Informs the receiver that it’

Re: NSTextView

2012-02-02 Thread Graham Cox
On 03/02/2012, at 12:34 PM, koko wrote: > IS there not an 'easy' way? theString = [theTextView string]; followed by [theString cStringUsingEncoding:] how mush easier could it be? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) P

Re: NSTextView : Scroll top when bound-to string changes

2012-01-22 Thread Ken Thomases
On Jan 20, 2012, at 7:33 AM, Jerry Krinock wrote: > I've bound the 'Attributed String' of an NSTextView. This view a detail > view; its text changes whenever the user changes the selection in an > associated table. Upon changing, the text scrolls to the bottom. I want it > to stay at the top

Re: NSTextView : Scroll top when bound-to string changes

2012-01-20 Thread Kyle Sluder
On Fri, Jan 20, 2012 at 11:22 AM, Jerry Krinock wrote: > Well, apparently this does not have a simple answer. > > I removed the binding from my text view and instead added an IBOutlet for it, > so I can use setAttributedString:, followed by setScrollPoint:. > > Conclusion: Although it has some bi

Re: NSTextView : Scroll top when bound-to string changes

2012-01-20 Thread Jerry Krinock
Well, apparently this does not have a simple answer. I removed the binding from my text view and instead added an IBOutlet for it, so I can use setAttributedString:, followed by setScrollPoint:. Conclusion: Although it has some bindings available, NSTextView is like NSMenu and NSMenuItem in tha

Re: NSTextView, spell checking and temporary attributes

2012-01-02 Thread Martin Hewitson
Yes, it seems I was mistaken. I also made a test app and can't reproduce the problem. So it must be something else I'm doing with the textview that stops the continuous spell checking from working. Oh well, more digging to do. Thanks for confirming! Martin On 2, Jan, 2012, at 08:07 PM, Seth

Re: NSTextView, spell checking and temporary attributes

2012-01-02 Thread Douglas Davidson
Are you making other modifications to temporary attributes? The spelling indicator does use various temporary attributes, though not background color, so (for example) clearing temporary attributes would interfere with it. Douglas Davidson On Jan 2, 2012, at 10:20 AM, Martin Hewitson wrote:

Re: NSTextView, spell checking and temporary attributes

2012-01-02 Thread Seth Willits
On Jan 2, 2012, at 10:20 AM, Martin Hewitson wrote: > [[self layoutManager] removeTemporaryAttribute:NSBackgroundColorAttributeName > forCharacterRange:visibleRange]; > > This has the unfortunate side-effect of removing the red squiggly lines which > indicate misspelled words. Hmm. Works fine

Re: NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.

2011-11-16 Thread Don Quixote de la Mancha
I am sympathetic with your reasoning, but I don't think it's what your users will expect. Most text-entry areas in most apps on most platforms start the text entry at the very top when they are empty, with the text entry advancing downwards. I suggest that you do not start scrolling your text unt

Re: NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.

2011-11-16 Thread Jens Alfke
On Nov 16, 2011, at 10:09 AM, Nick wrote: > Is there any > way I could make NSScrollView (which is a container for my NSTextView) be > able to scroll the textview even if there are not too many lines? Embed the text view in a taller NSView and put that view into the scrollview. Or you could jus

Re: NSTextView won't deallocate

2011-07-18 Thread Ryan Joseph
Absolutely. I saw that and started looking for crazy complicated answers before looking for the obvious sensible ones. My case was poor use of NSTextView/NSScrollView which was creating confusing cross-ownership scenarios that were difficult to balance in my code. On Jul 18, 2011, at 5:09 PM, K

Re: NSTextView won't deallocate

2011-07-18 Thread Kyle Sluder
On Mon, Jul 18, 2011 at 3:55 PM, Ryan Joseph wrote: > ;) I was being stupid in that example, I see how my ownership was still > retained until I called release (for NSTextView.alloc.initWithFrame) and > removeFromSuperview (for parent.addSubview). Since there's nothing strange > with NSTextView

Re: NSTextView won't deallocate

2011-07-18 Thread Ryan Joseph
;) I was being stupid in that example, I see how my ownership was still retained until I called release (for NSTextView.alloc.initWithFrame) and removeFromSuperview (for parent.addSubview). Since there's nothing strange with NSTextView like I originally thought I just need to pay very close atte

Re: NSTextView won't deallocate

2011-07-18 Thread Kyle Sluder
On Mon, Jul 18, 2011 at 3:40 PM, Ryan Joseph wrote: > In my simplified example this was indeed correct, it was autoreleased and was > deallocated on the next event cycle. I was convinced there as a problem with > NSTextView because other views were deallocated instantly but there was good > rea

Re: NSTextView won't deallocate

2011-07-18 Thread Ryan Joseph
In my simplified example this was indeed correct, it was autoreleased and was deallocated on the next event cycle. I was convinced there as a problem with NSTextView because other views were deallocated instantly but there was good reason. I guess I'm just retaining it somewhere that I'll need t

Re: NSTextView won't deallocate

2011-07-18 Thread Kyle Sluder
On Mon, Jul 18, 2011 at 2:30 PM, Peter wrote: > Yes - so the more appropriate question is why it was retained 4 times. > I don't see Cocoa doing it. > It's the programmer - mostly. > Could you give us more code? > > Cocoa gives us a very reliable way to know, when an object is released: If > the

Re: NSTextView won't deallocate

2011-07-18 Thread R
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextUILayer/Tasks/CreateTextViewProg.html%23//apple_ref/doc/uid/2930 On Jul 18, 3:30 pm, Peter wrote: > Yes - so the more appropriate question is why it was retained 4 times. > I don't see Cocoa doing it. > It's the pro

Re: NSTextView won't deallocate

2011-07-18 Thread Peter
Yes - so the more appropriate question is why it was retained 4 times. I don't see Cocoa doing it. It's the programmer - mostly. Could you give us more code? Cocoa gives us a very reliable way to know, when an object is released: If the reference count goes down to 0. The question now is how to b

Re: NSTextView won't deallocate

2011-07-18 Thread Graham Cox
You do know about autorelease pools, right? See whether the object survives the next event cycle. I'm betting it doesn't. Retain counts are none of your business, as is repeated almost daily on this list. Don't peek at them, infer nothing from them. Follow the ownership rules, and you'll be fin

Re: NSTextView won't deallocate

2011-07-18 Thread Ryan Joseph
Sure, I get reference counted memory and it could very well be true that Cocoa has no intent on releasing this at anytime I could expect and that was its design. If that's true when I would ask WHEN will it be deallocated? I'm leaking memory like crazy allocating these objects and would argue i

Re: NSTextView won't deallocate

2011-07-18 Thread Vincent Habchi
Le 18 juil. 2011 à 15:26, Ryan Joseph a écrit : > I literally mean that _exact_ snippet is leaking, 2 lines of code with no > retaining by any superviews. I only have limited experience with Cocoa and > don't use Objective C so maybe someone else could test this. Just allocate, > initialize the

Re: NSTextView won't deallocate

2011-07-18 Thread Peter
Maybe I am missing something, but given your example - which in some sense contradicts your comment, why do you expect dealloc to be called? If the retain count is in fact > 0 after the release (4 in your example below) dealloc is not called, since the view can not yet be deallocated. View.relea

Re: NSTextView won't deallocate

2011-07-18 Thread Ryan Joseph
I literally mean that _exact_ snippet is leaking, 2 lines of code with no retaining by any superviews. I only have limited experience with Cocoa and don't use Objective C so maybe someone else could test this. Just allocate, initialize then release the object and see if it's ever deallocated. Im

Re: NSTextView won't deallocate

2011-07-17 Thread Jens Alfke
On Jul 17, 2011, at 1:41 PM, Ryan Joseph wrote: > view := NSTextView.alloc.initWithFrame(NSMakeRect(0, 0, 0, 0)); > // retainCount = 5 > view.release; > // retainCount = 4, dealloc never called Impossible to tell from that snippet. Keep in mind that a view’s superview retains it, so a view in a

Re: NSTextView and NSTextContainer size & clipping area

2011-05-09 Thread Rimas M.
As far as I remember, text container inset sets "margins" from both sides: left and right and/or top and bottom. If text container position is important according to the text view, this will not work. 2011/5/8 Kyle Sluder > On May 8, 2011, at 3:27 AM, Дмитрий Николаев > wrote: > > > Custom text

Re: NSTextView and NSTextContainer size & clipping area

2011-05-08 Thread Дмитрий Николаев
I will try this solution too. Thanks for suggesting. 08.05.2011, в 21:33, Kyle Sluder написал(а): > On May 8, 2011, at 3:27 AM, Дмитрий Николаев wrote: > >> Custom textview resize policy set, so it resizes in all dimensions with >> container. This is code for custom NSTextView >> >> -

Re: NSTextView and NSTextContainer size & clipping area

2011-05-08 Thread Дмитрий Николаев
It works now. Thank you very much for help! 08.05.2011, в 20:27, Ross Carter написал(а): > Try wrapping the call to super like this: > > [NSGraphicsContext saveGraphicsState]; > [super drawRect:rect]; > [NSGraphicsContext restoreGraphicsState]; > > > On May 8, 2011, at 6:27 AM, Дмитрий Н

Re: NSTextView and NSTextContainer size & clipping area

2011-05-08 Thread Kyle Sluder
On May 8, 2011, at 3:27 AM, Дмитрий Николаев wrote: > Custom textview resize policy set, so it resizes in all dimensions with > container. This is code for custom NSTextView > > - > - (void) setFrameSize:(NSSize)newSize { > > [super setFrameSize:newSize]; > > NSTextContainer *cont

Re: NSTextView and NSTextContainer size & clipping area

2011-05-08 Thread Ross Carter
Try wrapping the call to super like this: [NSGraphicsContext saveGraphicsState]; [super drawRect:rect]; [NSGraphicsContext restoreGraphicsState]; On May 8, 2011, at 6:27 AM, Дмитрий Николаев wrote: > Code in Custom NSTextView - (void) drawRect: > > -- > [super drawRect:dirtyRec

Re: NSTextView and NSTextContainer size & clipping area

2011-05-08 Thread Дмитрий Николаев
Code in Custom NSTextView - (void) drawRect: -- [super drawRect:dirtyRect]; NSBezierPath* aPath = [NSBezierPath bezierPath]; [aPath moveToPoint:NSMakePoint(100, 100)]; [aPath lineToPoint:NSMakePoint(500, 100)]; [aPath stroke]; --- Custom textview resize policy set, so it resizes

Re: NSTextView and NSTextContainer size & clipping area

2011-05-07 Thread Ross Carter
We need to see your code. In general, any drawing code after the call to super in the textView's drawRect method will draw. But maybe you are trying to do something different. On May 7, 2011, at 3:13 AM, Дмитрий Николаев wrote: > But when i try draw a line in NSTextView, it limited to frame of

Re: NSTextView and NSTextContainer size & clipping area

2011-05-07 Thread Дмитрий Николаев
But when i try draw a line in NSTextView, it limited to frame of text container too. 06.05.2011, в 22:56, Ross Carter написал(а): > On May 6, 2011, at 2:40 AM, Дмитрий Николаев wrote: > >> If there are any possibility to draw inside text view but outside of text >> container ? > > It depends

Re: NSTextView and NSTextContainer size & clipping area

2011-05-06 Thread Ross Carter
On May 6, 2011, at 2:40 AM, Дмитрий Николаев wrote: > If there are any possibility to draw inside text view but outside of text > container ? It depends on who is doing the drawing. NSTextView is an NSView subclass and you can override drawRect: just like any NSView. The Cocoa text system, how

Re: NSTextView with custom space width

2011-04-21 Thread Ross Carter
On Apr 21, 2011, at 6:35 AM, Michael Dautermann wrote: > On Apr 18, 2011, at 5:37 AM, Дмитрий Николаев wrote: >> I need to implement custom separator with custom width between two part of >> paragraph in text view: >> >> AA A BBB B B >> >> This is separator must be included as non-

Re: NSTextView with custom space width

2011-04-21 Thread Michael Dautermann
On Apr 18, 2011, at 5:37 AM, Дмитрий Николаев wrote: > Hi to all! > > I need to implement custom separator with custom width between two part of > paragraph in text view: > > AA A BBB B B > > This is separator must be included as non-editable character. So user can't > delete i

Re: NSTextView truncating right side when printed...

2011-02-22 Thread Bruce Cresanta
I've tried word wrap, but I haven't tried character wrap yet.I thought it might have to do with layout in IB, but that is false because of the underlying text system/pdf.I don't understand your comment about tiling. Bruce On Feb 22, 2011, at 4:44 PM, Graham Cox wrote: > > On 23/02/2011

Re: NSTextView truncating right side when printed...

2011-02-22 Thread Graham Cox
On 23/02/2011, at 11:24 AM, Bruce Cresanta wrote: > I'm trying to print an NSTextView of HTML code.The right side is > truncated on the actual printout.Suggestions to correct this are > appreciated. What do you want it to do to be 'correct'? What have you tried? It's typical for HTML

  1   2   3   >