Temporary revert to fix auto-complete window processing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2013-09-11 18:43:55 +00:00
parent 45c1de514f
commit 5bebf8d94e
2 changed files with 16 additions and 20 deletions

View file

@ -26,7 +26,6 @@
#import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSRunLoop.h> #import <Foundation/NSRunLoop.h>
#import <Foundation/NSNotification.h> #import <Foundation/NSNotification.h>
#import "Foundation/NSUndoManager.h"
#import "AppKit/NSApplication.h" #import "AppKit/NSApplication.h"
#import "AppKit/NSBox.h" #import "AppKit/NSBox.h"
#import "AppKit/NSEvent.h" #import "AppKit/NSEvent.h"
@ -317,7 +316,7 @@ static GSAutocompleteWindow *gsWindow = nil;
if ([event window] != self) if ([event window] != self)
{ {
[self updateTextViewWithMovement: NSCancelTextMovement [self updateTextViewWithMovement: NSCancelTextMovement
isFinal: YES]; isFinal: NO];
break; break;
} }
else else
@ -353,7 +352,7 @@ static GSAutocompleteWindow *gsWindow = nil;
key == NSLeftArrowFunctionKey) key == NSLeftArrowFunctionKey)
{ {
[self updateTextViewWithMovement: NSCancelTextMovement [self updateTextViewWithMovement: NSCancelTextMovement
isFinal: YES]; isFinal: NO];
break; break;
} }
else else
@ -383,7 +382,7 @@ static GSAutocompleteWindow *gsWindow = nil;
{ {
_stopped = YES; _stopped = YES;
[self updateTextViewWithMovement: NSCancelTextMovement [self updateTextViewWithMovement: NSCancelTextMovement
isFinal: YES]; isFinal: NO];
} }
- (void) reloadData - (void) reloadData
@ -432,28 +431,25 @@ static GSAutocompleteWindow *gsWindow = nil;
{ {
NSString *word; NSString *word;
// If this is a cancelling request... if (movement != NSCancelTextMovement)
if (movement == NSCancelTextMovement)
{
// Invocation with flag==YES indicates we've inserted at least once
// causing text view to push an undo sequence that we need to undo
// here...
if (flag)
[[_textView undoManager] undo];
}
else
{ {
NSInteger rowIndex = [_tableView selectedRow]; NSInteger rowIndex = [_tableView selectedRow];
word = [[_words objectAtIndex: rowIndex] description]; word = [[_words objectAtIndex: rowIndex] description];
[_textView insertCompletion: word
forPartialWordRange: _range
movement: movement
isFinal: flag];
} }
else
{
word = _originalWord;
}
[_textView insertCompletion: word
forPartialWordRange: _range
movement: movement
isFinal: flag];
// Release _words and _originalWords if // Release _words and _originalWords if
// autocomplete is final or canceled. // autocomplete is final or canceled.
if ((flag) || (movement == NSCancelTextMovement) ) if ( (flag) ||
(movement == NSCancelTextMovement) )
{ {
ASSIGN(_originalWord, nil); ASSIGN(_originalWord, nil);
ASSIGN(_words, nil); ASSIGN(_words, nil);

View file

@ -2767,7 +2767,7 @@ TextDidEndEditing notification _without_ asking the delegate
[undo registerUndoWithTarget: _textStorage [undo registerUndoWithTarget: _textStorage
selector: @selector(_undoTextChange:) selector: @selector(_undoTextChange:)
object: undoObject]; object: undoObject];
if (isTyping || _tf.isAutoCompleting) if (isTyping) // || _tf.isAutoCompleting)
_undoObject = undoObject; _undoObject = undoObject;
else else
RELEASE(undoObject); RELEASE(undoObject);