First pass: autocompletion exception fix and invocation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37036 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2013-09-03 20:50:16 +00:00
parent bbc245709a
commit 6f19ceff5f
2 changed files with 22 additions and 2 deletions

View file

@ -29,6 +29,7 @@
#import "AppKit/NSApplication.h"
#import "AppKit/NSBox.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSLayoutManager.h"
#import "AppKit/NSScreen.h"
#import "AppKit/NSScrollView.h"
#import "AppKit/NSTableView.h"
@ -211,7 +212,7 @@ static GSAutocompleteWindow *gsWindow = nil;
[_textView convertRect: stringRect toView: nil].origin];
// Calculate the origin point to the window.
rect.origin.x = point.x - [NSScroller scrollerWidth] - 4;
rect.origin.x = point.x; // - [NSScroller scrollerWidth] - 4;
rect.origin.y = point.y - rect.size.height;
// If part of the window is off screen, change the origin point.

View file

@ -311,9 +311,9 @@ Interface for a bunch of internal methods that need to be cleaned up.
}
@end
@interface NSTextStorage(NSTextViewUndoSupport)
- (void) _undoTextChange: (NSTextViewUndoObject *)anObject;
- (BOOL) _isEditing;
@end
/**** Misc. helpers and stuff ****/
@ -2785,6 +2785,9 @@ After each user-induced change, this method should be called.
*/
- (void) didChangeText
{
if ([_textStorage _isEditing])
return;
[self scrollRangeToVisible: [self selectedRange]];
[notificationCenter postNotificationName: NSTextDidChangeNotification
object: _notifObject];
@ -5917,9 +5920,20 @@ static const NSInteger GSSpellingSuggestionMenuItemTag = 1;
[super keyDown: theEvent];
}
else
{
NSString *string = [theEvent characters];
// TEMPORARY...
// Invoke autocompletion on ESCAPE...
if (([string length] == 1) && ([string characterAtIndex: 0] == 0x1B))
{
[self complete: self];
}
else
{
[self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
}
}
}
/* Bind other mouse up to pasteSelection. This should be done via
@ -6571,4 +6585,9 @@ or add guards
[anObject performUndo: self];
}
- (BOOL) _isEditing
{
return (_editCount != 0);
}
@end