aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib119
-rw-r--r--Interfaces/English.lproj/Preferences.xib388
-rw-r--r--Resources/PreferenceDefaults.plist4
-rw-r--r--Source/CMTextView.h7
-rw-r--r--Source/CMTextView.m56
-rw-r--r--Source/CustomQuery.m6
-rw-r--r--Source/SPConstants.h2
-rw-r--r--Source/SPConstants.m2
-rw-r--r--Source/SPNarrowDownCompletion.h3
-rw-r--r--Source/SPNarrowDownCompletion.m19
10 files changed, 556 insertions, 50 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 47e08691..b425a7c5 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -24,6 +24,7 @@
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="6885"/>
+ <integer value="5281"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -62,7 +63,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{780, 480}</string>
<object class="NSView" key="NSWindowView" id="579726586">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2143,7 +2144,7 @@
<object class="NSTabViewItem" id="624106058">
<string key="NSIdentifier">content</string>
<object class="NSView" key="NSView" id="1013108064">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2883,7 +2884,6 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Content</string>
<reference key="NSColor" ref="62854682"/>
@@ -2892,7 +2892,7 @@
<object class="NSTabViewItem" id="105987292">
<string key="NSIdentifier">customQuery</string>
<object class="NSView" key="NSView" id="746504912">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2919,6 +2919,29 @@
<object class="NSTextView" id="1055190999">
<reference key="NSNextResponder" ref="1072692119"/>
<int key="NSvFlags">6418</int>
+ <object class="NSMutableSet" key="NSDragTypes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="set.sortedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
+ <string>NeXT RTFD pasteboard type</string>
+ <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+ <string>NeXT TIFF v4.0 pasteboard type</string>
+ <string>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ <string>public.url</string>
+ </object>
+ </object>
<string key="NSFrameSize">{694, 14}</string>
<reference key="NSSuperview" ref="1072692119"/>
<object class="NSTextContainer" key="NSTextContainer" id="326170846">
@@ -3640,6 +3663,16 @@
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
+ <object class="NSMenuItem" id="919863898">
+ <reference key="NSMenu" ref="60735230"/>
+ <string key="NSTitle">Auto-completion</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="450876295"/>
+ <reference key="NSMixedImage" ref="414351669"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="984501775"/>
+ </object>
<object class="NSMenuItem" id="414081589">
<reference key="NSMenu" ref="60735230"/>
<string key="NSTitle">Update Help while typing</string>
@@ -3653,7 +3686,7 @@
</object>
<bool key="NSNoAutoenable">YES</bool>
</object>
- <int key="NSSelectedIndex">17</int>
+ <int key="NSSelectedIndex">19</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -3799,6 +3832,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Custom Query</string>
<reference key="NSColor" ref="62854682"/>
@@ -5444,14 +5478,14 @@
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="624106058"/>
+ <reference key="NSSelectedTabViewItem" ref="105987292"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1013108064"/>
+ <reference ref="746504912"/>
</object>
</object>
</object>
@@ -5468,6 +5502,7 @@
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
+ <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{780, 502}</string>
@@ -11710,6 +11745,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSUserDefaultsController" id="461189245">
+ <object class="NSMutableArray" key="NSDeclaredKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>CustomQueryAutoComplete</string>
+ <string>CustomQueryAuto</string>
+ <string>CustomQueryAutoUppercaseKeywords</string>
+ </object>
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSCustomObject" id="601471102">
@@ -14093,22 +14134,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5859</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.CustomQueryAutoUppercaseKeywords</string>
- <reference key="source" ref="81663257"/>
- <reference key="destination" ref="461189245"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="81663257"/>
- <reference key="NSDestination" ref="461189245"/>
- <string key="NSLabel">value: values.CustomQueryAutoUppercaseKeywords</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.CustomQueryAutoUppercaseKeywords</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">5860</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectTableColumn:</string>
<reference key="source" ref="885866030"/>
@@ -16165,6 +16190,38 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6904</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryAutoComplete</string>
+ <reference key="source" ref="919863898"/>
+ <reference key="destination" ref="461189245"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="919863898"/>
+ <reference key="NSDestination" ref="461189245"/>
+ <string key="NSLabel">value: values.CustomQueryAutoComplete</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryAutoComplete</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">6910</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryAutoUppercaseKeywords</string>
+ <reference key="source" ref="81663257"/>
+ <reference key="destination" ref="461189245"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="81663257"/>
+ <reference key="NSDestination" ref="461189245"/>
+ <string key="NSLabel">value: values.CustomQueryAutoUppercaseKeywords</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryAutoUppercaseKeywords</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">6912</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -18410,6 +18467,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="594285746"/>
<reference ref="635467451"/>
<reference ref="128208712"/>
+ <reference ref="919863898"/>
</object>
<reference key="parent" ref="984501775"/>
</object>
@@ -22752,6 +22810,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="828761093"/>
<reference key="parent" ref="513459867"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6908</int>
+ <reference key="object" ref="919863898"/>
+ <reference key="parent" ref="60735230"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -24131,6 +24194,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>69.ImportedFromIB2</string>
<string>6901.IBPluginDependency</string>
<string>6902.IBPluginDependency</string>
+ <string>6908.IBPluginDependency</string>
<string>711.IBPluginDependency</string>
<string>711.ImportedFromIB2</string>
<string>713.IBPluginDependency</string>
@@ -24940,11 +25004,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{402, -257}, {944, 550}}</string>
+ <string>{{-1, 152}, {944, 550}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<boolean value="NO"/>
- <string>{{402, -257}, {944, 550}}</string>
+ <string>{{-1, 152}, {944, 550}}</string>
<integer value="1"/>
<integer value="1"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -25110,7 +25174,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{110, 61}, {256, 445}}</string>
+ <string>{{202, 69}, {256, 462}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -26127,6 +26191,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
@@ -26269,7 +26334,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6907</int>
+ <int key="maxID">6912</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib
index 04efb9eb..4d8b75cd 100644
--- a/Interfaces/English.lproj/Preferences.xib
+++ b/Interfaces/English.lproj/Preferences.xib
@@ -3721,10 +3721,155 @@ AQAAAAA</bytes>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
+ <object class="NSButton" id="827082642">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{257, 144}, {179, 18}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="92164221">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Auto-Completion</string>
+ <reference key="NSSupport" ref="320262838"/>
+ <reference key="NSControlView" ref="827082642"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="752798171"/>
+ <reference key="NSAlternateImage" ref="888311049"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="184945490">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{357, 119}, {29, 19}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="409964321">
+ <int key="NSCellFlags">-1538130368</int>
+ <int key="NSCellFlags2">-2076048384</int>
+ <string key="NSContents">0.1</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSNumberFormatter" key="NSFormatter" id="706329937">
+ <object class="NSMutableDictionary" key="NS.attributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>allowsFloats</string>
+ <string>alwaysShowsDecimalSeparator</string>
+ <string>decimalSeparator</string>
+ <string>formatterBehavior</string>
+ <string>groupingSeparator</string>
+ <string>locale</string>
+ <string>maximum</string>
+ <string>maximumIntegerDigits</string>
+ <string>minimum</string>
+ <string>minimumFractionDigits</string>
+ <string>positiveFormat</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ <boolean value="YES"/>
+ <string>.</string>
+ <integer value="1040"/>
+ <string/>
+ <reference ref="894463536"/>
+ <real value="20"/>
+ <integer value="1"/>
+ <real value="0.10000000000000001"/>
+ <integer value="1"/>
+ <string>#.0</string>
+ </object>
+ </object>
+ <string key="NS.positiveformat">#.0</string>
+ <string key="NS.negativeformat">#.0</string>
+ <nil key="NS.positiveattrs"/>
+ <nil key="NS.negativeattrs"/>
+ <nil key="NS.zero"/>
+ <nil key="NS.nil"/>
+ <object class="NSAttributedString" key="NS.nan">
+ <string key="NSString">NaN</string>
+ <reference key="NSAttributes" ref="469277987"/>
+ </object>
+ <real value="0.10000000000000001" key="NS.min"/>
+ <real value="20" key="NS.max"/>
+ <object class="NSDecimalNumberHandler" key="NS.rounding">
+ <int key="NS.roundingmode">3</int>
+ <bool key="NS.raise.overflow">YES</bool>
+ <bool key="NS.raise.underflow">YES</bool>
+ <bool key="NS.raise.dividebyzero">YES</bool>
+ </object>
+ <string key="NS.decimal">.</string>
+ <string key="NS.thousand"/>
+ <bool key="NS.hasthousands">NO</bool>
+ <bool key="NS.localized">NO</bool>
+ <bool key="NS.allowsfloats">YES</bool>
+ </object>
+ <reference key="NSControlView" ref="184945490"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="1001357688"/>
+ <reference key="NSTextColor" ref="6928728"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="892250776">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{298, 121}, {54, 14}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="1060023867">
+ <int key="NSCellFlags">605158976</int>
+ <int key="NSCellFlags2">71435264</int>
+ <string key="NSContents">Delay by:</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="892250776"/>
+ <reference key="NSBackgroundColor" ref="700609571"/>
+ <reference key="NSTextColor" ref="1035618107"/>
+ </object>
+ </object>
+ <object class="NSStepper" id="107658761">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{392, 117}, {15, 22}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSStepperCell" key="NSCell" id="171005061">
+ <int key="NSCellFlags">604896800</int>
+ <int key="NSCellFlags2">131072</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="107658761"/>
+ <double key="NSValue">1</double>
+ <double key="NSMinValue">0.10000000000000001</double>
+ <double key="NSMaxValue">5</double>
+ <double key="NSIncrement">0.10000000000000001</double>
+ <bool key="NSAutorepeat">YES</bool>
+ </object>
+ </object>
+ <object class="NSTextField" id="1009372112">
+ <reference key="NSNextResponder" ref="1033452264"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{410, 121}, {27, 14}}</string>
+ <reference key="NSSuperview" ref="1033452264"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="201150384">
+ <int key="NSCellFlags">605158976</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">secs</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="1009372112"/>
+ <reference key="NSBackgroundColor" ref="700609571"/>
+ <reference key="NSTextColor" ref="1035618107"/>
+ </object>
+ </object>
<object class="NSButton" id="774563613">
<reference key="NSNextResponder" ref="1033452264"/>
<int key="NSvFlags">-2147483380</int>
- <string key="NSFrame">{{257, 144}, {197, 18}}</string>
+ <string key="NSFrame">{{257, 91}, {197, 18}}</string>
<reference key="NSSuperview" ref="1033452264"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="420702000">
@@ -3896,7 +4041,8 @@ AQAAAAA</bytes>
<object class="NSUserDefaultsController" id="151174232">
<object class="NSMutableArray" key="NSDeclaredKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>CustomQueryEditorTabStopWidth</string>
+ <string>CustomQueryAutoComplete</string>
+ <string>CustomQueryAutoCompleteDelay</string>
</object>
<bool key="NSSharedInstance">YES</bool>
</object>
@@ -6040,6 +6186,134 @@ AQAAAAA</bytes>
</object>
<int key="connectionID">1516</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">takeFloatValueFrom:</string>
+ <reference key="source" ref="107658761"/>
+ <reference key="destination" ref="184945490"/>
+ </object>
+ <int key="connectionID">1528</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">takeFloatValueFrom:</string>
+ <reference key="source" ref="184945490"/>
+ <reference key="destination" ref="107658761"/>
+ </object>
+ <int key="connectionID">1529</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: values.CustomQueryUpdateAutoHelp</string>
+ <reference key="source" ref="1009372112"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="1009372112"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">enabled: values.CustomQueryUpdateAutoHelp</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">values.CustomQueryUpdateAutoHelp</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1534</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: values.CustomQueryUpdateAutoHelp</string>
+ <reference key="source" ref="892250776"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="892250776"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">enabled: values.CustomQueryUpdateAutoHelp</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">values.CustomQueryUpdateAutoHelp</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1535</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryAutoComplete</string>
+ <reference key="source" ref="827082642"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="827082642"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">value: values.CustomQueryAutoComplete</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryAutoComplete</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1537</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryAutoCompleteDelay</string>
+ <reference key="source" ref="184945490"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="184945490"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">value: values.CustomQueryAutoCompleteDelay</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryAutoCompleteDelay</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1538</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: values.CustomQueryAutoComplete</string>
+ <reference key="source" ref="184945490"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="184945490"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">enabled: values.CustomQueryAutoComplete</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">values.CustomQueryAutoComplete</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1539</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CustomQueryAutoCompleteDelay</string>
+ <reference key="source" ref="107658761"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="107658761"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">value: values.CustomQueryAutoCompleteDelay</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CustomQueryAutoCompleteDelay</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1540</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: values.CustomQueryAutoComplete</string>
+ <reference key="source" ref="107658761"/>
+ <reference key="destination" ref="151174232"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="107658761"/>
+ <reference key="NSDestination" ref="151174232"/>
+ <string key="NSLabel">enabled: values.CustomQueryAutoComplete</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">values.CustomQueryAutoComplete</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">1541</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -7058,6 +7332,11 @@ AQAAAAA</bytes>
<reference ref="161634003"/>
<reference ref="304684720"/>
<reference ref="1018119488"/>
+ <reference ref="1009372112"/>
+ <reference ref="107658761"/>
+ <reference ref="892250776"/>
+ <reference ref="184945490"/>
+ <reference ref="827082642"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">Editor</string>
@@ -8578,6 +8857,85 @@ AQAAAAA</bytes>
<reference key="object" ref="141894253"/>
<reference key="parent" ref="248584789"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1517</int>
+ <reference key="object" ref="1009372112"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="201150384"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1518</int>
+ <reference key="object" ref="107658761"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="171005061"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1519</int>
+ <reference key="object" ref="892250776"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1060023867"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1520</int>
+ <reference key="object" ref="184945490"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="409964321"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1521</int>
+ <reference key="object" ref="827082642"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="92164221"/>
+ </object>
+ <reference key="parent" ref="1033452264"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1522</int>
+ <reference key="object" ref="92164221"/>
+ <reference key="parent" ref="827082642"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1523</int>
+ <reference key="object" ref="409964321"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="706329937"/>
+ </object>
+ <reference key="parent" ref="184945490"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1524</int>
+ <reference key="object" ref="706329937"/>
+ <reference key="parent" ref="409964321"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1525</int>
+ <reference key="object" ref="1060023867"/>
+ <reference key="parent" ref="892250776"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1526</int>
+ <reference key="object" ref="171005061"/>
+ <reference key="parent" ref="107658761"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1527</int>
+ <reference key="object" ref="201150384"/>
+ <reference key="parent" ref="1009372112"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -8796,6 +9154,18 @@ AQAAAAA</bytes>
<string>1507.IBNumberFormatterBehaviorMetadataKey</string>
<string>1507.IBNumberFormatterLocalizesFormatMetadataKey</string>
<string>1507.IBPluginDependency</string>
+ <string>1517.IBPluginDependency</string>
+ <string>1518.IBPluginDependency</string>
+ <string>1519.IBPluginDependency</string>
+ <string>1520.IBPluginDependency</string>
+ <string>1521.IBPluginDependency</string>
+ <string>1522.IBPluginDependency</string>
+ <string>1523.IBPluginDependency</string>
+ <string>1524.IBNumberFormatterLocalizesFormatMetadataKey</string>
+ <string>1524.IBPluginDependency</string>
+ <string>1525.IBPluginDependency</string>
+ <string>1526.IBPluginDependency</string>
+ <string>1527.IBPluginDependency</string>
<string>17.IBEditorWindowLastContentRect</string>
<string>17.IBPluginDependency</string>
<string>17.IBUserGuides</string>
@@ -9276,6 +9646,18 @@ AQAAAAA</bytes>
<integer value="1041"/>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <boolean value="YES"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{571, 222}, {500, 280}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableArray">
@@ -9659,7 +10041,7 @@ AQAAAAA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">1516</int>
+ <int key="maxID">1541</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index dd4a8a59..5b941ba3 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -86,6 +86,10 @@
<false/>
<key>CustomQueryEditorTabStopWidth</key>
<integer>4</integer>
+ <key>CustomQueryAutoComplete</key>
+ <false/>
+ <key>CustomQueryAutoCompleteDelay</key>
+ <real>1.5</real>
<key>CustomQueryAutoHelpDelay</key>
<real>1</real>
<key>lastSqlFileEncoding</key>
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index 53afe0df..558bc284 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -73,6 +73,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
NSInteger currentSnippetIndex;
BOOL snippetWasJustInserted;
+ BOOL completionIsOpen;
NSColor *queryHiliteColor;
NSColor *queryEditorBackgroundColor;
@@ -99,6 +100,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
@property(retain) NSColor* otherTextColor;
@property(assign) NSRange queryRange;
@property(assign) BOOL shouldHiliteQuery;
+@property(assign) BOOL completionIsOpen;
- (IBAction)showMySQLHelpForCurrentWord:(id)sender;
@@ -128,12 +130,13 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
- (void) doSyntaxHighlighting;
- (NSBezierPath*)roundedBezierPathAroundRange:(NSRange)aRange;
- (void) setConnection:(MCPConnection *)theConnection withVersion:(NSInteger)majorVersion;
-- (void) doCompletionByUsingSpellChecker:(BOOL)isDictMode fuzzyMode:(BOOL)fuzzySearch;
+- (void) doCompletionByUsingSpellChecker:(BOOL)isDictMode fuzzyMode:(BOOL)fuzzySearch autoCompleteMode:(BOOL)autoCompleteMode;
+- (void) doAutoCompletion;
- (NSArray *)suggestionsForSQLCompletionWith:(NSString *)currentWord dictMode:(BOOL)isDictMode browseMode:(BOOL)dbBrowseMode withTableName:(NSString*)aTableName withDbName:(NSString*)aDbName;
- (void) selectCurrentQuery;
- (BOOL)checkForCaretInsideSnippet;
-- (void)insertFavoriteAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange;
+- (void)insertAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange;
- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint;
- (void)insertFileContentOfFile:(NSString *)aPath;
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index e32e1234..30c4d7a5 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -98,6 +98,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS
@synthesize otherTextColor;
@synthesize queryRange;
@synthesize shouldHiliteQuery;
+@synthesize completionIsOpen;
/*
* Sort function (mainly used to sort the words in the textView)
@@ -126,6 +127,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
startListeningToBoundChanges = NO;
textBufferSizeIncreased = NO;
snippetControlCounter = -1;
+ completionIsOpen = NO;
lineNumberView = [[NoodleLineNumberView alloc] initWithScrollView:scrollView];
[scrollView setVerticalRulerView:lineNumberView];
@@ -177,6 +179,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[prefs addObserver:self forKeyPath:SPCustomQueryEditorVariableColor options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorTextColor options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:self forKeyPath:SPCustomQueryAutoUppercaseKeywords options:NSKeyValueObservingOptionNew context:NULL];
}
@@ -234,6 +237,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorTabStopWidth]) {
[self setTabStops];
+ } else if ([keyPath isEqualToString:SPCustomQueryAutoUppercaseKeywords]) {
+ [self setAutouppercaseKeywords:[prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]];
}
}
@@ -467,7 +472,21 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
-- (void) doCompletionByUsingSpellChecker:(BOOL)isDictMode fuzzyMode:(BOOL)fuzzySearch
+- (void) doAutoCompletion
+{
+ NSRange r = [self selectedRange];
+
+ if(![[self delegate] isKindOfClass:[CustomQuery class]] || r.length || snippetControlCounter > -1) return;
+
+ if(r.location) {
+ if([[[self textStorage] attribute:kQuote atIndex:r.location-1 effectiveRange:nil] isEqualToString:kQuoteValue])
+ return;
+ if(![[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[[self string] characterAtIndex:r.location-1]])
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:YES];
+ }
+}
+
+- (void) doCompletionByUsingSpellChecker:(BOOL)isDictMode fuzzyMode:(BOOL)fuzzySearch autoCompleteMode:(BOOL)autoCompleteMode
{
if(![self isEditable]) return;
@@ -475,7 +494,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self breakUndoCoalescing];
NSUInteger caretPos = NSMaxRange([self selectedRange]);
- // [self setSelectedRange:NSMakeRange(caretPos, 0)];
+
BOOL caretMovedLeft = NO;
// Check if caret is located after a ` - if so move caret inside
@@ -501,14 +520,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Break for long stuff
if(completionRange.length>100000) return;
-
NSString* allow; // additional chars which not close the popup
if(isDictMode)
allow= @"_";
else
allow= @"_. ";
-
BOOL dbBrowseMode = NO;
NSInteger backtickMode = 0; // 0 none, 1 rigth only, 2 left only, 3 both
BOOL caseInsensitive = YES;
@@ -669,7 +686,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
withDbName:dbName
withTableName:tableName
selectedDb:currentDb
- caretMovedLeft:caretMovedLeft];
+ caretMovedLeft:caretMovedLeft
+ autoComplete:autoCompleteMode];
//Get the NSPoint of the first character of the current word
NSRange glyphRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(completionRange.location,1) actualCharacterRange:NULL];
@@ -685,6 +703,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
pos.y -= [[self font] pointSize]*1.25;
[completionPopUp setCaretPos:pos];
+ completionIsOpen = YES;
[completionPopUp orderFront:self];
[completionPopUp insertCommonPrefix];
@@ -1083,7 +1102,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Inserts a chosen query favorite and initialze a snippet session if user defined any
*/
-- (void)insertFavoriteAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange
+- (void)insertAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange
{
// Do not allow the insertion of a query favorite if snippets are active
@@ -1496,14 +1515,21 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
long curFlags = ([theEvent modifierFlags] & allFlags);
if ([theEvent keyCode] == 53 && [self isEditable]){ // ESC key for internal completion
+
+ // Cancel autocompletion trigger
+ if([prefs boolForKey:SPCustomQueryAutoComplete])
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(doAutoCompletion)
+ object:nil];
+
if(curFlags==(NSControlKeyMask))
- [self doCompletionByUsingSpellChecker:NO fuzzyMode:YES];
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:YES autoCompleteMode:NO];
else
- [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO];
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:NO];
return;
}
if (insertedCharacter == NSF5FunctionKey && [self isEditable]){ // F5 for completion based on spell checker
- [self doCompletionByUsingSpellChecker:YES fuzzyMode:NO];
+ [self doCompletionByUsingSpellChecker:YES fuzzyMode:NO autoCompleteMode:NO];
return;
}
@@ -1557,7 +1583,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(snippetControlCounter < 0 && [[[self window] delegate] fileURL]) {
NSArray *snippets = [[SPQueryController sharedQueryController] queryFavoritesForFileURL:[[[self window] delegate] fileURL] andTabTrigger:tabTrigger includeGlobals:YES];
if([snippets count] > 0 && [(NSString*)[(NSDictionary*)[snippets objectAtIndex:0] objectForKey:@"query"] length]) {
- [self insertFavoriteAsSnippet:[(NSDictionary*)[snippets objectAtIndex:0] objectForKey:@"query"] atRange:targetRange];
+ [self insertAsSnippet:[(NSDictionary*)[snippets objectAtIndex:0] objectForKey:@"query"] atRange:targetRange];
return;
}
}
@@ -3391,6 +3417,16 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] doubleValue]];
}
+ // Cancel autocompletion trigger
+ if([prefs boolForKey:SPCustomQueryAutoComplete])
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(doAutoCompletion)
+ object:nil];
+
+ // Start autocompletion if enabled
+ if([prefs boolForKey:SPCustomQueryAutoComplete] && !completionIsOpen && editedMask != 1)
+ [self performSelector:@selector(doAutoCompletion) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoCompleteDelay] retain] doubleValue]];
+
// Cancel calling doSyntaxHighlighting for large text
if([[self string] length] > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING)
[NSObject cancelPreviousPerformRequestsWithTarget:self
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index e586557e..e3d26d74 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -222,7 +222,7 @@
}
// The actual query strings have been already stored as tooltip
- [textView insertFavoriteAsSnippet:[[queryFavoritesButton selectedItem] toolTip] atRange:NSMakeRange([textView selectedRange].location, 0)];
+ [textView insertAsSnippet:[[queryFavoritesButton selectedItem] toolTip] atRange:NSMakeRange([textView selectedRange].location, 0)];
}
}
@@ -325,9 +325,9 @@
// on normal autocomplete usage.
if (sender == completionListMenuItem) {
if([[NSApp currentEvent] modifierFlags] & (NSControlKeyMask))
- [textView doCompletionByUsingSpellChecker:NO fuzzyMode:YES];
+ [textView doCompletionByUsingSpellChecker:NO fuzzyMode:YES autoCompleteMode:NO];
else
- [textView doCompletionByUsingSpellChecker:NO fuzzyMode:NO];
+ [textView doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:NO];
}
// "Editor font..." menu item to bring up the font panel
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 12f2a38f..83ce6996 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -135,6 +135,8 @@ extern NSString *SPCustomQueryUpdateAutoHelp;
extern NSString *SPCustomQueryAutoHelpDelay;
extern NSString *SPCustomQueryHighlightCurrentQuery;
extern NSString *SPCustomQueryEditorTabStopWidth;
+extern NSString *SPCustomQueryAutoComplete;
+extern NSString *SPCustomQueryAutoCompleteDelay;
// AutoUpdate Prefpane
extern NSString *SPLastUsedVersion;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index bea60f8b..aa2c3508 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -103,6 +103,8 @@ NSString *SPCustomQueryUpdateAutoHelp = @"CustomQueryUpdateAutoHelp";
NSString *SPCustomQueryAutoHelpDelay = @"CustomQueryAutoHelpDelay";
NSString *SPCustomQueryHighlightCurrentQuery = @"CustomQueryHighlightCurrentQuery";
NSString *SPCustomQueryEditorTabStopWidth = @"CustomQueryEditorTabStopWidth";
+NSString *SPCustomQueryAutoComplete = @"CustomQueryAutoComplete";
+NSString *SPCustomQueryAutoCompleteDelay = @"CustomQueryAutoCompleteDelay";
// AutoUpdate Prefpane
NSString *SPLastUsedVersion = @"LastUsedVersion";
diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h
index 96558b9d..6901ffa1 100644
--- a/Source/SPNarrowDownCompletion.h
+++ b/Source/SPNarrowDownCompletion.h
@@ -49,6 +49,7 @@
BOOL noFilterString;
BOOL cursorMovedLeft;
BOOL commaInsertionMode;
+ BOOL autoCompletionMode;
NSInteger backtickMode;
NSFont *tableFont;
NSRange theCharRange;
@@ -68,7 +69,7 @@
charRange:(NSRange)initRange parseRange:(NSRange)parseRange inView:(id)aView
dictMode:(BOOL)mode dbMode:(BOOL)theDbMode tabTriggerMode:(BOOL)tabTriggerMode fuzzySearch:(BOOL)fuzzySearch
backtickMode:(NSInteger)theBackTickMode withDbName:(NSString*)dbName withTableName:(NSString*)tableName
- selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft;
+ selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft autoComplete:(BOOL)autoComplete;
- (void)setCaretPos:(NSPoint)aPos;
- (void)insert_text:(NSString* )aString;
- (void)insertCommonPrefix;
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 032e80b3..8e5bebec 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -136,7 +136,7 @@
charRange:(NSRange)initRange parseRange:(NSRange)parseRange inView:(id)aView
dictMode:(BOOL)mode dbMode:(BOOL)theDbMode tabTriggerMode:(BOOL)tabTriggerMode fuzzySearch:(BOOL)fuzzySearch
backtickMode:(NSInteger)theBackTickMode withDbName:(NSString*)dbName withTableName:(NSString*)tableName
- selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft
+ selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft autoComplete:(BOOL)autoComplete
{
if(self = [self init])
{
@@ -145,6 +145,8 @@
if(aUserString)
[mutablePrefix appendString:aUserString];
+ autoCompletionMode = autoComplete;
+
fuzzyMode = fuzzySearch;
if(fuzzyMode)
[theTableView setBackgroundColor:[NSColor colorWithCalibratedRed:0.9f green:0.9f blue:0.9f alpha:1.0f]];
@@ -371,6 +373,7 @@
- (void)checkSpaceForAllowedCharacter
{
[textualInputCharacters removeCharactersInString:@" "];
+ if(autoCompletionMode) return;
if(spaceCounter < 1)
for(id w in filtered){
if([[w objectForKey:@"match"] ?: [w objectForKey:@"display"] rangeOfString:@" "].length) {
@@ -444,11 +447,16 @@
}
if(![newFiltered count]) {
- if([[self filterString] hasSuffix:@"."]) {
- [theView doCompletionByUsingSpellChecker:dictMode fuzzyMode:fuzzyMode];
+ if(autoCompletionMode) {
closeMe = YES;
+ return;
+ } else {
+ if([[self filterString] hasSuffix:@"."]) {
+ [theView doCompletionByUsingSpellChecker:dictMode fuzzyMode:fuzzyMode autoCompleteMode:NO];
+ closeMe = YES;
+ }
+ [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No completions found", @"no completions found message"), @"display", @"", @"noCompletion", nil]];
}
- [newFiltered addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"No completions found", @"no completions found message"), @"display", @"", @"noCompletion", nil]];
}
NSPoint old = NSMakePoint([self frame].origin.x, [self frame].origin.y + [self frame].size.height);
@@ -615,6 +623,7 @@
[NSApp sendEvent:event];
}
}
+ [theView setCompletionIsOpen:NO];
[self close];
usleep(70); // tiny delay to suppress while continously pressing of ESC overlapping
}
@@ -665,6 +674,8 @@
// If completion string contains backticks move caret out of the backticks
if(backtickMode && !triggerMode)
[theView performSelector:@selector(moveRight:)];
+ else if([[[filtered objectAtIndex:[theTableView selectedRow]] objectForKey:@"image"] hasPrefix:@"func"])
+ [theView insertAsSnippet:@"(${1:})" atRange:[theView selectedRange]];
}
- (void)completeAndInsertSnippet