aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPCopyTable.h6
-rw-r--r--Source/SPCopyTable.m10
-rw-r--r--Source/SPCustomQuery.m16
-rw-r--r--Source/SPFieldEditorController.m8
-rw-r--r--Source/SPTableContent.h6
-rw-r--r--Source/SPTableContent.m14
6 files changed, 58 insertions, 2 deletions
diff --git a/Source/SPCopyTable.h b/Source/SPCopyTable.h
index 49867ac1..4ed8dfb7 100644
--- a/Source/SPCopyTable.h
+++ b/Source/SPCopyTable.h
@@ -47,8 +47,14 @@
NSUserDefaults *prefs;
+ NSRange fieldEditorSelectedRange;
+
}
+
+- (void)setFieldEditorSelectedRange:(NSRange)aRange;
+- (NSRange)fieldEditorSelectedRange;
+
/*!
@method copy:
@abstract does the work of copying
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index 98dd45aa..66b97a81 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -38,6 +38,16 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003;
@implementation SPCopyTable
+- (void)setFieldEditorSelectedRange:(NSRange)aRange
+{
+ fieldEditorSelectedRange = aRange;
+}
+
+- (NSRange)fieldEditorSelectedRange
+{
+ return fieldEditorSelectedRange;
+}
+
- (void)copy:(id)sender
{
NSString *tmp = nil;
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 831ff44f..4b3ca24b 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -3436,6 +3436,16 @@
}
+- (void)setFieldEditorSelectedRange:(NSRange)aRange
+{
+ [customQueryView setFieldEditorSelectedRange:aRange];
+}
+
+- (NSRange)fieldEditorSelectedRange
+{
+ return [customQueryView fieldEditorSelectedRange];
+}
+
#pragma mark -
- (id)init
@@ -3599,6 +3609,9 @@
// Check if current edited field is a blob or should be displayed in field editor sheet
if (isBlob || [multipleLineEditingButton state] == NSOnState)
{
+
+ [customQueryView setFieldEditorSelectedRange:[fieldEditor selectedRange]];
+
// Cancel editing
[control abortEditing];
@@ -3680,6 +3693,9 @@
*/
- (void)awakeFromNib
{
+
+ [customQueryView setFieldEditorSelectedRange:NSMakeRange(0,0)];
+
// Set pre-defined menu tags
[queryFavoritesSaveAsMenuItem setTag:SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG];
[queryFavoritesSaveAllMenuItem setTag:SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG];
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 05266381..a5ec347d 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -29,6 +29,7 @@
#import "SPDataCellFormatter.h"
#import "SPTooltip.h"
#import "SPGeometryDataView.h"
+#import "SPCopyTable.h"
#include <objc/objc-runtime.h>
@implementation SPFieldEditorController
@@ -403,8 +404,11 @@
}
// Locate the caret in editTextView
- // (to select all takes a bit time for large data)
- [editTextView setSelectedRange:NSMakeRange(0,0)];
+ // (restore a given selection coming from the in-cell editing mode)
+ NSRange selRange = [callerInstance fieldEditorSelectedRange];
+ [editTextView setSelectedRange:selRange];
+ [callerInstance setFieldEditorSelectedRange:NSMakeRange(0,0)];
+
// If the string content is NULL select NULL for convenience
if([stringValue isEqualToString:[prefs objectForKey:SPNullValue]])
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index d1a70a5c..893d767d 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -134,8 +134,14 @@
NSColor *lightGrayColor;
SPFieldEditorController *fieldEditor;
+ NSRange fieldEditorSelectedRange;
+
}
+
+- (void)setFieldEditorSelectedRange:(NSRange)aRange;
+- (NSRange)fieldEditorSelectedRange;
+
// Table loading methods and information
- (void) loadTable:(NSString *)aTable;
- (void) clearTableValues;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 13d58e3a..fe9e37ec 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -171,6 +171,8 @@
[paginationView setFrame:paginationViewFrame];
[contentViewPane addSubview:paginationView];
+ [tableContentView setFieldEditorSelectedRange:NSMakeRange(0,0)];
+
// Init Filter Table GUI
[filterTableDistinctMenuItem setState:(filterTableDistinct) ? NSOnState : NSOffState];
[filterTableNegateCheckbox setState:(filterTableNegate) ? NSOnState : NSOffState];
@@ -4210,6 +4212,8 @@
if ((fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column) headerCell] stringValue]] objectForKey:@"typegrouping"])
&& ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"] || [multipleLineEditingButton state] == NSOnState))
{
+ [tableContentView setFieldEditorSelectedRange:[fieldEditor selectedRange]];
+
// Cancel editing
[control abortEditing];
@@ -4475,6 +4479,16 @@
}
}
+- (void)setFieldEditorSelectedRange:(NSRange)aRange
+{
+ [tableContentView setFieldEditorSelectedRange:aRange];
+}
+
+- (NSRange)fieldEditorSelectedRange
+{
+ return [tableContentView fieldEditorSelectedRange];
+}
+
#pragma mark -
/**