aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-14 10:25:40 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-14 10:25:40 +0000
commit71394ef3837299457b1a5b65ff562c3be6985bba (patch)
treed604d24a2fedb7a66c1b92c6940786d46b92e2e6
parent3033e428aba1418e7797fb987c1280c6db67c305 (diff)
downloadsequelpro-71394ef3837299457b1a5b65ff562c3be6985bba.tar.gz
sequelpro-71394ef3837299457b1a5b65ff562c3be6985bba.tar.bz2
sequelpro-71394ef3837299457b1a5b65ff562c3be6985bba.zip
• fixed GUI problem for line numbering in Query Editor
• improved Bundle command script editor • sped up a bit the NoodleLineNumbering by pre-calculation of constants used in a loop • fixed issue to detect the scope Query Editor better and safer for Bundle commands
-rw-r--r--Interfaces/English.lproj/BundleEditor.xib5
-rw-r--r--Interfaces/English.lproj/DBView.xib56
-rw-r--r--Source/NoodleLineNumberView.m141
-rw-r--r--Source/SPBundleCommandTextView.m20
-rw-r--r--Source/SPTextViewAdditions.m2
5 files changed, 110 insertions, 114 deletions
diff --git a/Interfaces/English.lproj/BundleEditor.xib b/Interfaces/English.lproj/BundleEditor.xib
index 8f224ad4..25be786e 100644
--- a/Interfaces/English.lproj/BundleEditor.xib
+++ b/Interfaces/English.lproj/BundleEditor.xib
@@ -23,7 +23,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="683"/>
+ <integer value="686"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -383,7 +383,6 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">3</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -875,7 +874,7 @@
<string key="NSFrame">{{20, 140}, {506, 189}}</string>
<reference key="NSSuperview" ref="338542681"/>
<reference key="NSNextKeyView" ref="971406968"/>
- <int key="NSsFlags">562</int>
+ <int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="414961522"/>
<reference key="NSHScroller" ref="724741922"/>
<reference key="NSContentView" ref="971406968"/>
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 1e9085a1..760c4033 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -23,13 +23,13 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="7208"/>
+ <integer value="7210"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.brandonwalkin.BWToolkit</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
@@ -222,7 +222,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor" id="1001122760">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="454249633"/>
@@ -3530,7 +3530,7 @@
<string>public.url</string>
</object>
</object>
- <string key="NSFrame">{{0, -8}, {694, 14}}</string>
+ <string key="NSFrameSize">{694, 14}</string>
<reference key="NSSuperview" ref="888807510"/>
<object class="NSTextContainer" key="NSTextContainer" id="845974686">
<object class="NSLayoutManager" key="NSLayoutManager">
@@ -4575,7 +4575,7 @@
<reference key="NSSuperview" ref="618407678"/>
<reference key="NSTarget" ref="618407678"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.98496240601503759</double>
+ <double key="NSPercent">0.98496240377426147</double>
</object>
<object class="NSScroller" id="195758564">
<reference key="NSNextResponder" ref="618407678"/>
@@ -7205,7 +7205,7 @@
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="234287744">
<nil key="NSNextResponder"/>
@@ -7359,7 +7359,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="423199625">
<int key="NSWindowStyleMask">7</int>
@@ -7369,7 +7369,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">Reset Auto Increment</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{255, 95}</string>
<object class="NSView" key="NSWindowView" id="748618982">
<nil key="NSNextResponder"/>
@@ -7532,7 +7532,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
<string key="NSMinSize">{255, 117}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="787219800">
<int key="NSWindowStyleMask">1</int>
@@ -7542,7 +7542,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">New Relation</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="842408319">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -8143,7 +8143,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSFrameSize">{302, 307}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="437271354">
<int key="NSWindowStyleMask">9</int>
@@ -8153,7 +8153,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">New Trigger</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{360, 348}</string>
<object class="NSView" key="NSWindowView" id="729080358">
<nil key="NSNextResponder"/>
@@ -8560,7 +8560,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{360, 370}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="1066802919">
<int key="NSWindowStyleMask">3</int>
@@ -8572,7 +8572,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 50}</string>
<object class="NSView" key="NSWindowView" id="525490268">
<nil key="NSNextResponder"/>
@@ -8692,7 +8692,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{213, 72}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="553728448">
<int key="NSWindowStyleMask">9</int>
@@ -8704,7 +8704,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="1052076676">
<nil key="NSNextResponder"/>
@@ -8839,7 +8839,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="828950706">
<int key="NSWindowStyleMask">15</int>
@@ -8851,7 +8851,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{350, 200}</string>
<object class="NSView" key="NSWindowView" id="749598685">
<nil key="NSNextResponder"/>
@@ -9074,7 +9074,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{350, 222}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPCreateSyntaxSheet</string>
</object>
<object class="NSWindowTemplate" id="466147946">
@@ -9087,7 +9087,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="860968037">
<nil key="NSNextResponder"/>
@@ -9257,7 +9257,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{213, 129}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSWindowTemplate" id="78186995">
<int key="NSWindowStyleMask">31</int>
@@ -9267,7 +9267,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">MySQL Help</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{351, 120}</string>
<object class="NSView" key="NSWindowView" id="539508428">
<nil key="NSNextResponder"/>
@@ -9665,7 +9665,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string>
<string key="NSMinSize">{351, 136}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">MYSQL_HELP_WINDOW</string>
</object>
<object class="NSWindowTemplate" id="633448481">
@@ -9676,7 +9676,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowTitle">Filter</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{380, 170}</string>
<object class="NSView" key="NSWindowView" id="257361103">
<nil key="NSNextResponder"/>
@@ -10318,7 +10318,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{380, 192}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName">SPTableFilterPanel</string>
</object>
<object class="NSWindowTemplate" id="923391973">
@@ -10818,7 +10818,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSWindowTitle">Secure Text Input Sheet</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="978976687">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@@ -10922,7 +10922,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSFrameSize">{338, 150}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSCustomView" id="884983195">
<nil key="NSNextResponder"/>
@@ -11105,7 +11105,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA</bytes>
<string key="NSColorName">disabledControlTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
+ <bytes key="NSWhite">MC4zMzMzMzMzNDMzAA</bytes>
</object>
</object>
</object>
diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m
index 0bb9b25e..9e0d284a 100644
--- a/Source/NoodleLineNumberView.m
+++ b/Source/NoodleLineNumberView.m
@@ -353,7 +353,7 @@
- (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
{
- id view;
+ id view;
NSRect bounds;
bounds = [self bounds];
@@ -362,87 +362,88 @@
{
[backgroundColor set];
NSRectFill(bounds);
-
+
[[NSColor colorWithCalibratedWhite:0.58 alpha:1.0] set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(bounds) - 0/5, NSMinY(bounds)) toPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMaxY(bounds))];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMinY(bounds)) toPoint:NSMakePoint(NSMaxX(bounds) - 0.5, NSMaxY(bounds))];
}
-
- view = [self clientView];
-
- if ([view isKindOfClass:[NSTextView class]])
- {
- NSLayoutManager *layoutManager;
- NSTextContainer *container;
- NSRect visibleRect;
- NSRange range, glyphRange, nullRange;
- NSString *text, *labelText;
- NSUInteger rectCount, index, line, count;
- NSRectArray rects;
- CGFloat ypos, yinset;
- NSDictionary *textAttributes, *currentTextAttributes;
- NSSize stringSize;
+
+ view = [self clientView];
+
+ if ([view isKindOfClass:[NSTextView class]])
+ {
+ NSLayoutManager *layoutManager;
+ NSTextContainer *container;
+ NSRect visibleRect;
+ NSRange range, glyphRange, nullRange;
+ NSString *text, *labelText;
+ NSUInteger rectCount, index, line, count;
+ NSRectArray rects;
+ CGFloat ypos, yinset;
+ NSDictionary *textAttributes;
+ NSSize stringSize;
NSMutableArray *lines;
- layoutManager = [view layoutManager];
- container = [view textContainer];
- text = [view string];
- nullRange = NSMakeRange(NSNotFound, 0);
-
+ layoutManager = [view layoutManager];
+ container = [view textContainer];
+ text = [view string];
+ nullRange = NSMakeRange(NSNotFound, 0);
+
yinset = [view textContainerInset].height;
- visibleRect = [[[self scrollView] contentView] bounds];
+ visibleRect = [[[self scrollView] contentView] bounds];
+
+ textAttributes = [self textAttributes];
- textAttributes = [self textAttributes];
-
lines = [self lineIndices];
- // Find the characters that are currently visible
- glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect inTextContainer:container];
- range = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
-
- // Fudge the range a tad in case there is an extra new line at end.
- // It doesn't show up in the glyphs so would not be accounted for.
- range.length++;
-
- count = [lines count];
-
- for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
- {
- index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
-
- if (NSLocationInRange(index, range))
- {
- rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
- withinSelectedCharacterRange:nullRange
- inTextContainer:container
- rectCount:&rectCount];
-
- if (rectCount > 0)
- {
- // Note that the ruler view is only as tall as the visible
- // portion. Need to compensate for the clipview's coordinates.
- ypos = yinset + NSMinY(rects[0]) - NSMinY(visibleRect);
-
- // Line numbers are internally stored starting at 0
- labelText = [NSString stringWithFormat:@"%lu", (unsigned long)(line + 1)];
-
- stringSize = [labelText sizeWithAttributes:textAttributes];
-
- currentTextAttributes = textAttributes;
-
- // Draw string flush right, centered vertically within the line
- [labelText drawInRect:
- NSMakeRect(NSWidth(bounds) - stringSize.width - RULER_MARGIN,
- ypos + (NSHeight(rects[0]) - stringSize.height) / 2.0,
- NSWidth(bounds) - RULER_MARGIN * 2.0, NSHeight(rects[0]))
- withAttributes:currentTextAttributes];
- }
- }
+ // Find the characters that are currently visible
+ glyphRange = [layoutManager glyphRangeForBoundingRect:visibleRect inTextContainer:container];
+ range = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
+
+ // Fudge the range a tad in case there is an extra new line at end.
+ // It doesn't show up in the glyphs so would not be accounted for.
+ range.length++;
+
+ count = [lines count];
+
+ CGFloat boundsRULERMargin2 = NSWidth(bounds) - RULER_MARGIN * 2.0;
+ CGFloat boundsWidthRULER = NSWidth(bounds) - RULER_MARGIN;
+ CGFloat yinsetMinY = yinset - NSMinY(visibleRect);
+
+ for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
+ {
+ index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
+
+ if (NSLocationInRange(index, range))
+ {
+ rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
+ withinSelectedCharacterRange:nullRange
+ inTextContainer:container
+ rectCount:&rectCount];
+
+ if (rectCount > 0)
+ {
+ // Note that the ruler view is only as tall as the visible
+ // portion. Need to compensate for the clipview's coordinates.
+
+ // Line numbers are internally stored starting at 0
+ labelText = [NSString stringWithFormat:@"%lu", (NSUInteger)(line + 1)];
+
+ stringSize = [labelText sizeWithAttributes:textAttributes];
+
+ // Draw string flush right, centered vertically within the line
+ [labelText drawInRect:
+ NSMakeRect(boundsWidthRULER - stringSize.width,
+ yinsetMinY + NSMinY(rects[0]) + ((NSHeight(rects[0]) - stringSize.height) / 2.0),
+ boundsRULERMargin2, NSHeight(rects[0]))
+ withAttributes:textAttributes];
+ }
+ }
if (index > NSMaxRange(range))
{
break;
}
- }
- }
+ }
+ }
}
- (void)mouseDown:(NSEvent *)theEvent
diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m
index 8a5bf620..6411ccfd 100644
--- a/Source/SPBundleCommandTextView.m
+++ b/Source/SPBundleCommandTextView.m
@@ -29,25 +29,15 @@
@implementation SPBundleCommandTextView
-- (id)init
-{
- if(self = [super init])
- {
- ;
- }
- return self;
-}
-
- (void)dealloc
{
-
- [[NSNotificationCenter defaultCenter] removeObserver:self];
[prefs removeObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
[prefs release];
[lineNumberView release];
}
-- (void) awakeFromNib
+- (void)awakeFromNib
{
prefs = [[NSUserDefaults standardUserDefaults] retain];
@@ -68,6 +58,12 @@
// Re-define tab stops for a better editing
[self setTabStops];
+ // add NSViewBoundsDidChangeNotification to scrollView
+ [[commandScrollView contentView] setPostsBoundsChangedNotifications:YES];
+
+ // disabled to get the current text range in textView safer
+ [[self layoutManager] setBackgroundLayoutEnabled:NO];
+
}
- (void)drawRect:(NSRect)rect
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 11defa20..3eeb46ce 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -534,7 +534,7 @@
[[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil];
- BOOL selfIsQueryEditor = ([[[self class] description] isEqualToString:@"SPTextView"]) ;
+ BOOL selfIsQueryEditor = ([[[self class] description] isEqualToString:@"SPTextView"] && [self respondsToSelector:@selector(currentQueryRange)]) ;
if([cmdData objectForKey:SPBundleFileInputSourceKey])
inputAction = [[cmdData objectForKey:SPBundleFileInputSourceKey] lowercaseString];