aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/MainMenu.xib504
-rw-r--r--Source/CMTextView.m147
-rw-r--r--Source/SPTextViewAdditions.h10
-rw-r--r--Source/SPTextViewAdditions.m180
4 files changed, 286 insertions, 555 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 2b06210a..50e6e528 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="849"/>
+ <integer value="854"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4128,6 +4128,78 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
</object>
<int key="connectionID">866</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectCurrentWord:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="57673608"/>
+ </object>
+ <int key="connectionID">895</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectCurrentLine:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="12564442"/>
+ </object>
+ <int key="connectionID">896</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doSelectionUpperCase:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="557911082"/>
+ </object>
+ <int key="connectionID">897</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doSelectionLowerCase:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="947912173"/>
+ </object>
+ <int key="connectionID">898</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doSelectionTitleCase:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="1810"/>
+ </object>
+ <int key="connectionID">899</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doDecomposedStringWithCanonicalMapping:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="357051646"/>
+ </object>
+ <int key="connectionID">900</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doPrecomposedStringWithCanonicalMapping:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="76683506"/>
+ </object>
+ <int key="connectionID">901</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doDecomposedStringWithCompatibilityMapping:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="730037442"/>
+ </object>
+ <int key="connectionID">902</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doPrecomposedStringWithCompatibilityMapping:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="569879567"/>
+ </object>
+ <int key="connectionID">903</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -6156,7 +6228,6 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<reference key="object" ref="533054394"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="557911082"/>
<reference ref="947912173"/>
<reference ref="1810"/>
<reference ref="575099285"/>
@@ -6164,6 +6235,7 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<reference ref="827111917"/>
<reference ref="413134863"/>
<reference ref="975213454"/>
+ <reference ref="557911082"/>
</object>
<reference key="parent" ref="287358431"/>
</object>
@@ -6935,7 +7007,7 @@ ARcABAAAAAEAAAACARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{232, 439}, {157, 253}}</string>
+ <string>{{234, 225}, {157, 253}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{654, 613}, {157, 223}}</string>
@@ -7145,7 +7217,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{84, 692}, {511, 20}}</string>
+ <string>{{86, 478}, {511, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{506, 836}, {511, 20}}</string>
@@ -7534,7 +7606,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{389, 499}, {213, 143}}</string>
+ <string>{{391, 285}, {213, 143}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
@@ -7576,7 +7648,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{602, 429}, {304, 93}}</string>
+ <string>{{604, 215}, {304, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -7630,24 +7702,12 @@ w6gg4oaSIGZhY2FkZV0</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">894</int>
+ <int key="maxID">903</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">CMCopyTable</string>
- <string key="superclassName">NSTableView</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">copy:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMCopyTable.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
@@ -7720,14 +7780,6 @@ w6gg4oaSIGZhY2FkZV0</string>
<string key="className">KeyChain</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/KeyChain.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">KeyChain</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
@@ -7736,108 +7788,6 @@ w6gg4oaSIGZhY2FkZV0</string>
<string key="className">MainController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addFavorite:</string>
- <string>checkForUpdates:</string>
- <string>chooseLimitRows:</string>
- <string>closeFavoriteSheet:</string>
- <string>copyFavorite:</string>
- <string>donate:</string>
- <string>openPreferences:</string>
- <string>removeFavorite:</string>
- <string>toggleUseSSH:</string>
- <string>visitHelpWebsite:</string>
- <string>visitWebsite:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>databaseField</string>
- <string>dontShowBlobSwitch</string>
- <string>encodingPopUpButton</string>
- <string>favoriteSheet</string>
- <string>fetchRowCountSwitch</string>
- <string>hostField</string>
- <string>keyChainInstance</string>
- <string>limitRowsField</string>
- <string>limitRowsSwitch</string>
- <string>nameField</string>
- <string>nullValueField</string>
- <string>passwordField</string>
- <string>portField</string>
- <string>preferencesWindow</string>
- <string>reloadAfterAddingSwitch</string>
- <string>reloadAfterEditingSwitch</string>
- <string>reloadAfterRemovingSwitch</string>
- <string>showErrorSwitch</string>
- <string>socketField</string>
- <string>sshCheckbox</string>
- <string>sshHostField</string>
- <string>sshPasswordField</string>
- <string>sshPortField</string>
- <string>sshUserField</string>
- <string>tableView</string>
- <string>useMonospacedFontsSwitch</string>
- <string>userField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/MainController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">MainController</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">closePreferences:</string>
<string key="NS.object.0">id</string>
</object>
@@ -7854,243 +7804,31 @@ w6gg4oaSIGZhY2FkZV0</string>
<string key="minorKey"/>
</object>
</object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMImageView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/CMMCPConnection.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">SPQueryConsole</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>clearConsole:</string>
- <string>copy:</string>
- <string>saveConsoleAs:</string>
- <string>toggleShowSelectShowStatements:</string>
- <string>toggleShowTimeStamps:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>clearConsoleButton</string>
- <string>consoleSearchField</string>
- <string>consoleTableView</string>
- <string>includeTimeStampsButton</string>
- <string>progressIndicator</string>
- <string>saveConsoleButton</string>
- <string>saveLogView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSButton</string>
- <string>NSSearchField</string>
- <string>NSTableView</string>
- <string>NSButton</string>
- <string>NSProgressIndicator</string>
- <string>NSButton</string>
- <string>NSView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/SPQueryConsole.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TableDocument</string>
- <string key="superclassName">NSDocument</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addDatabase:</string>
- <string>analyzeTable:</string>
- <string>cancelConnectSheet:</string>
- <string>checkTable:</string>
- <string>checksumTable:</string>
- <string>chooseDatabase:</string>
- <string>chooseEncoding:</string>
- <string>chooseFavorite:</string>
- <string>closeDatabaseSheet:</string>
- <string>closeSheet:</string>
- <string>connect:</string>
- <string>connectSheetAddToFavorites:</string>
- <string>connectToDB:</string>
- <string>copyCreateTableSyntax:</string>
- <string>export:</string>
- <string>exportMultipleTables:</string>
- <string>exportTable:</string>
- <string>flushPrivileges:</string>
- <string>flushTable:</string>
- <string>import:</string>
- <string>optimizeTable:</string>
- <string>removeDatabase:</string>
- <string>removeFavorite:</string>
- <string>repairTable:</string>
- <string>setDatabases:</string>
- <string>showCreateTableSyntax:</string>
- <string>showVariables:</string>
- <string>viewContent:</string>
- <string>viewQuery:</string>
- <string>viewStatus:</string>
- <string>viewStructure:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addDatabaseButton</string>
- <string>chooseDatabaseButton</string>
- <string>connectFavoritesTableView</string>
- <string>connectProgressBar</string>
- <string>connectProgressStatusText</string>
- <string>connectSheet</string>
- <string>createTableSyntaxWindow</string>
- <string>customQueryInstance</string>
- <string>customQueryTextView</string>
- <string>databaseEncodingButton</string>
- <string>databaseField</string>
- <string>databaseNameField</string>
- <string>databaseSheet</string>
- <string>dbTablesTableView</string>
- <string>favoritesButton</string>
- <string>favoritesController</string>
- <string>hostField</string>
- <string>keyChainInstance</string>
- <string>passwordField</string>
- <string>portField</string>
- <string>queryProgressBar</string>
- <string>sidebarGrabber</string>
- <string>socketField</string>
- <string>syntaxView</string>
- <string>syntaxViewContent</string>
- <string>tableContentInstance</string>
- <string>tableDataInstance</string>
- <string>tableDumpInstance</string>
- <string>tableSourceInstance</string>
- <string>tableStatusInstance</string>
- <string>tableTabView</string>
- <string>tableWindow</string>
- <string>tablesListInstance</string>
- <string>userField</string>
- <string>variablesSheet</string>
- <string>variablesTableView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>NSTableView</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSWindow</string>
- <string>id</string>
- <string>NSTextView</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSTableView</string>
- <string>id</string>
- <string>NSArrayController</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSTabView</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/TableDocument.h</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="939419192">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">TablesList</string>
- <string key="superclassName">NSObject</string>
+ <string key="className">NSTextView</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>addTable:</string>
- <string>closeCopyTableSheet:</string>
- <string>closeTableSheet:</string>
- <string>copyTable:</string>
- <string>removeTable:</string>
- <string>updateTables:</string>
+ <string>doDecomposedStringWithCanonicalMapping:</string>
+ <string>doDecomposedStringWithCompatibilityMapping:</string>
+ <string>doPrecomposedStringWithCanonicalMapping:</string>
+ <string>doPrecomposedStringWithCompatibilityMapping:</string>
+ <string>doSelectionLowerCase:</string>
+ <string>doSelectionTitleCase:</string>
+ <string>doSelectionUpperCase:</string>
+ <string>selectCurrentLine:</string>
+ <string>selectCurrentWord:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -8100,64 +7838,14 @@ w6gg4oaSIGZhY2FkZV0</string>
<string>id</string>
<string>id</string>
<string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addTableButton</string>
- <string>copyTableContentSwitch</string>
- <string>copyTableNameField</string>
- <string>copyTableSheet</string>
- <string>customQueryInstance</string>
- <string>tabView</string>
- <string>tableContentInstance</string>
- <string>tableDataInstance</string>
- <string>tableDocumentInstance</string>
- <string>tableDumpInstance</string>
- <string>tableEncodingButton</string>
- <string>tableNameField</string>
- <string>tableSheet</string>
- <string>tableSourceInstance</string>
- <string>tableStatusInstance</string>
- <string>tableWindow</string>
- <string>tablesListView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/TablesList.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="939419192">
<string key="majorKey">IBDocumentRelativeSource</string>
- <string key="minorKey">../../Frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h</string>
+ <string key="minorKey">../../Source/SPTextViewAdditions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 49aee2cf..0493f0c8 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -117,46 +117,6 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
/*
- * Select current line and returns found NSRange.
- */
-- (NSRange)selectCurrentLine
-{
- [self doCommandBySelector:@selector(moveToBeginningOfLine:)];
- [self doCommandBySelector:@selector(moveToEndOfLineAndModifySelection:)];
-
- return([self selectedRange]);
-}
-
-/*
- * Select current word and returns found NSRange.
- * finds: [| := caret] |word wo|rd word|
- * If | is in between whitespaces nothing will be selected.
- */
-- (NSRange)selectCurrentWord
-{
- NSRange curRange = [self selectedRange];
- unsigned long curLocation = curRange.location;
- [self doCommandBySelector:@selector(moveWordLeft:)];
- [self doCommandBySelector:@selector(moveWordRightAndModifySelection:)];
-
- unsigned long newStartRange = [self selectedRange].location;
- unsigned long newEndRange = newStartRange + [self selectedRange].length;
-
- // if current location does not intersect with found range
- // then caret is at the begin of a word -> change strategy
- if(curLocation < newStartRange || curLocation > newEndRange)
- {
- [self setSelectedRange:curRange];
- [self doCommandBySelector:@selector(moveWordRightAndModifySelection:)];
- }
-
- if([[[self string] substringWithRange:[self selectedRange]] rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].location != NSNotFound)
- [self setSelectedRange:curRange];
-
- return([self selectedRange]);
-}
-
-/*
* Copy selected text chunk as RTF to preserve syntax highlighting
*/
- (void)copyAsRTF
@@ -175,76 +135,6 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
-/*
- * Change selection or current word to upper case and preserves the selection.
- */
-- (void)doSelectionUpperCase
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] uppercaseString]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word to lower case and preserves the selection.
- */
-- (void)doSelectionLowerCase
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] lowercaseString]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word to title case and preserves the selection.
- */
-- (void)doSelectionTitleCase
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] capitalizedString]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word according to Unicode's NFD and preserves the selection.
- */
-- (void)doDecomposedStringWithCanonicalMapping
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] decomposedStringWithCanonicalMapping]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word according to Unicode's NFKD and preserves the selection.
- */
-- (void)doDecomposedStringWithCompatibilityMapping
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] decomposedStringWithCompatibilityMapping]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word according to Unicode's NFC and preserves the selection.
- */
-- (void)doPrecomposedStringWithCanonicalMapping
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] precomposedStringWithCanonicalMapping]];
- [self setSelectedRange:curRange];
-}
-
-/*
- * Change selection or current word according to Unicode's NFKC to title case and preserves the selection.
- */
-- (void)doPrecomposedStringWithCompatibilityMapping
-{
- NSRange curRange = [self selectedRange];
- [self insertText:[[[self string] substringWithRange:(curRange.length)?curRange:[self selectCurrentWord]] precomposedStringWithCompatibilityMapping]];
- [self setSelectedRange:curRange];
-}
-
/*
* Handle some keyDown events in order to provide autopairing functionality (if enabled).
@@ -271,20 +161,6 @@ YY_BUFFER_STATE yy_scan_string (const char *);
// Note: switch(insertedCharacter) {} does not work instead use charactersIgnoringModifiers
- if([charactersIgnMod isEqualToString:@"w"]) // ^W select current word
- if(curFlags==(NSControlKeyMask))
- {
- [self selectCurrentWord];
- return;
- }
-
- if([charactersIgnMod isEqualToString:@"l"]) // ^L select current line
- if(curFlags==(NSControlKeyMask))
- {
- [self selectCurrentLine];
- return;
- }
-
if([charactersIgnMod isEqualToString:@"c"]) // ^C copy as RTF
if(curFlags==(NSControlKeyMask))
{
@@ -292,29 +168,6 @@ YY_BUFFER_STATE yy_scan_string (const char *);
return;
}
- if([charactersIgnMod isEqualToString:@"u"])
- // ^U upper case
- if(curFlags==(NSControlKeyMask))
- {
- [self doSelectionUpperCase];
- return;
- }
- // ^⌥U title case
- if(curFlags==(NSControlKeyMask|NSAlternateKeyMask))
- {
- [self doSelectionTitleCase];
- return;
- }
-
- if([charactersIgnMod isEqualToString:@"U"]) // ^⇧U lower case
- if(([theEvent modifierFlags]
- & (NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask))==(NSControlKeyMask))
- {
- [self doSelectionLowerCase];
- return;
- }
-
-
// Only process for character autopairing if autopairing is enabled and a single character is being added.
if (autopairEnabled && characters && [characters length] == 1) {
diff --git a/Source/SPTextViewAdditions.h b/Source/SPTextViewAdditions.h
index eacd7724..0aaa4cde 100644
--- a/Source/SPTextViewAdditions.h
+++ b/Source/SPTextViewAdditions.h
@@ -24,4 +24,14 @@
@interface NSTextView (SPTextViewAdditions)
+- (IBAction)selectCurrentWord:(id)sender;
+- (IBAction)selectCurrentLine:(id)sender;
+- (IBAction)doSelectionUpperCase:(id)sender;
+- (IBAction)doSelectionLowerCase:(id)sender;
+- (IBAction)doSelectionTitleCase:(id)sender;
+- (IBAction)doDecomposedStringWithCanonicalMapping:(id)sender;
+- (IBAction)doDecomposedStringWithCompatibilityMapping:(id)sender;
+- (IBAction)doPrecomposedStringWithCanonicalMapping:(id)sender;
+- (IBAction)doPrecomposedStringWithCompatibilityMapping:(id)sender;
+
@end \ No newline at end of file
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 426cc1b5..6031399d 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -24,5 +24,185 @@
@implementation NSTextView (SPTextViewAdditions)
+/*
+ * Returns the range of the current word.
+ * finds: [| := caret] |word wo|rd word|
+ * If | is in between whitespaces nothing will be selected.
+ */
+- (NSRange)getRangeForCurrentWord
+{
+
+ NSRange curRange = [self selectedRange];
+ unsigned long curLocation = curRange.location;
+
+ [self moveWordLeft:self];
+ [self moveWordRightAndModifySelection:self];
+
+ unsigned long newStartRange = [self selectedRange].location;
+ unsigned long newEndRange = newStartRange + [self selectedRange].length;
+
+ // if current location does not intersect with found range
+ // then caret is at the begin of a word -> change strategy
+ if(curLocation < newStartRange || curLocation > newEndRange)
+ {
+ [self setSelectedRange:curRange];
+ [self moveWordRightAndModifySelection:self];
+ }
+
+ if([[[self string] substringWithRange:[self selectedRange]] rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].location != NSNotFound)
+ [self setSelectedRange:curRange];
+
+ NSRange wordRange = [self selectedRange];
+
+ [self setSelectedRange:curRange];
+
+ return(wordRange);
+
+}
+
+/*
+ * Select current word.
+ * finds: [| := caret] |word wo|rd word|
+ * If | is in between whitespaces nothing will be selected.
+ */
+- (IBAction)selectCurrentWord:(id)sender
+{
+ [self setSelectedRange:[self getRangeForCurrentWord]];
+}
+
+/*
+ * Select current line.
+ */
+- (IBAction)selectCurrentLine:(id)sender
+{
+ [self doCommandBySelector:@selector(moveToBeginningOfLine:)];
+ [self doCommandBySelector:@selector(moveToEndOfLineAndModifySelection:)];
+}
+
+/*
+ * Change selection or current word to upper case and preserves the selection.
+ */
+- (IBAction)doSelectionUpperCase:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ [self insertText:[[[self string] substringWithRange:selRange] uppercaseString]];
+ [self setSelectedRange:curRange];
+}
+
+/*
+ * Change selection or current word to lower case and preserves the selection.
+ */
+- (IBAction)doSelectionLowerCase:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ [self insertText:[[[self string] substringWithRange:selRange] lowercaseString]];
+ [self setSelectedRange:curRange];
+}
+
+/*
+ * Change selection or current word to title case and preserves the selection.
+ */
+- (IBAction)doSelectionTitleCase:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ [self insertText:[[[self string] substringWithRange:selRange] capitalizedString]];
+ [self setSelectedRange:curRange];
+}
+
+/*
+ * Change selection or current word according to Unicode's NFD and preserves the selection.
+ */
+- (IBAction)doDecomposedStringWithCanonicalMapping:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ NSString* convString = [[[self string] substringWithRange:selRange] decomposedStringWithCanonicalMapping];
+ [self insertText:convString];
+
+ // correct range for combining characters
+ if(curRange.length)
+ [self setSelectedRange:NSMakeRange(selRange.location, [convString length])];
+ else
+ // if no selection place the caret at the end of the current word
+ {
+ NSRange newRange = [self getRangeForCurrentWord];
+ [self setSelectedRange:NSMakeRange(newRange.location + newRange.length, 0)];
+ }
+}
+
+/*
+ * Change selection or current word according to Unicode's NFKD and preserves the selection.
+ */
+- (IBAction)doDecomposedStringWithCompatibilityMapping:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ NSString* convString = [[[self string] substringWithRange:selRange] decomposedStringWithCompatibilityMapping];
+ [self insertText:convString];
+
+ // correct range for combining characters
+ if(curRange.length)
+ [self setSelectedRange:NSMakeRange(selRange.location, [convString length])];
+ else
+ // if no selection place the caret at the end of the current word
+ {
+ NSRange newRange = [self getRangeForCurrentWord];
+ [self setSelectedRange:NSMakeRange(newRange.location + newRange.length, 0)];
+ }
+}
+
+/*
+ * Change selection or current word according to Unicode's NFC and preserves the selection.
+ */
+- (IBAction)doPrecomposedStringWithCanonicalMapping:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ NSString* convString = [[[self string] substringWithRange:selRange] precomposedStringWithCanonicalMapping];
+ [self insertText:convString];
+
+ // correct range for combining characters
+ if(curRange.length)
+ [self setSelectedRange:NSMakeRange(selRange.location, [convString length])];
+ else
+ // if no selection place the caret at the end of the current word
+ {
+ NSRange newRange = [self getRangeForCurrentWord];
+ [self setSelectedRange:NSMakeRange(newRange.location + newRange.length, 0)];
+ }
+}
+
+/*
+ * Change selection or current word according to Unicode's NFKC to title case and preserves the selection.
+ */
+- (IBAction)doPrecomposedStringWithCompatibilityMapping:(id)sender
+{
+ NSRange curRange = [self selectedRange];
+ NSRange selRange = (curRange.length) ? curRange : [self getRangeForCurrentWord];
+ [self setSelectedRange:selRange];
+ NSString* convString = [[[self string] substringWithRange:selRange] precomposedStringWithCompatibilityMapping];
+ [self insertText:convString];
+
+ // correct range for combining characters
+ if(curRange.length)
+ [self setSelectedRange:NSMakeRange(selRange.location, [convString length])];
+ else
+ // if no selection place the caret at the end of the current word
+ {
+ NSRange newRange = [self getRangeForCurrentWord];
+ [self setSelectedRange:NSMakeRange(newRange.location + newRange.length, 0)];
+ }
+}
+
+
@end