aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-06-12 17:56:09 +0000
committerrowanbeentje <rowan@beent.je>2010-06-12 17:56:09 +0000
commit78331b709c5f43e6ecbdedd3af06ed0dcf398dc9 (patch)
treed2ed5481f354472b03f2a556c233b5f92db0828b
parent2fa13f3ded3449d0a4ddd0357ca42d6b075d07a8 (diff)
downloadsequelpro-78331b709c5f43e6ecbdedd3af06ed0dcf398dc9.tar.gz
sequelpro-78331b709c5f43e6ecbdedd3af06ed0dcf398dc9.tar.bz2
sequelpro-78331b709c5f43e6ecbdedd3af06ed0dcf398dc9.zip
- Alter the behaviour of the return key in structure view, making it consistent with the Content view and triggering a row save
-rw-r--r--Source/SPTableStructure.m22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index bbab0785..6145774b 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -1595,9 +1595,9 @@ would result in a position change.
row = [tableSourceView editedRow];
column = [tableSourceView editedColumn];
- if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ||
- [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) //trap enter and tab
- {
+ // Trap the tab key, selecting the next item in the line
+ if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] )
+ {
//save current line
[[control window] makeFirstResponder:control];
if ( column == 9 ) {
@@ -1618,10 +1618,20 @@ would result in a position change.
}
}
return TRUE;
+
+ // Trap the enter key, triggering a save
+ }
+ else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] )
+ {
+ [[control window] makeFirstResponder:control];
+ [self addRowToDB];
+ return TRUE;
- } else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
- [textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) {
- //abort editing
+ // Trap escape, aborting the edit and reverting the row
+ }
+ else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
+ [textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] )
+ {
[control abortEditing];
if ( isEditingRow && !isEditingNewRow ) {
isEditingRow = NO;