Register for undo/redo notifications so we can hide the suggestions

list. Fixes the urlbar font size. (bug 159606)
This commit is contained in:
pinkerton%netscape.com 2002-08-14 22:11:02 +00:00
parent 14da5c905d
commit ef17840fcd
8 changed files with 64 additions and 4 deletions

View File

@ -85,6 +85,7 @@
- (void) onRowClicked:(NSNotification *)aNote;
- (void) onBlur:(NSNotification *)aNote;
- (void) onResize:(NSNotification *)aNote;
- (void) onUndoOrRedo:(NSNotification *)aNote;
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
- (id) fieldEditor;

View File

@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
NS_IF_ADDREF(mListener);
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setDelegate: self];
// XXX the owner of the textfield should set this
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
name:NSWindowDidResizeNotification object:nil];
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidRedoChangeNotification
object:[[self fieldEditor] undoManager]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidUndoChangeNotification
object:[[self fieldEditor] undoManager]];
// read the user default on if we should auto-complete the text field as the user
// types or make them pick something from a list (a-la mozilla).
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self resizePopup];
}
- (void) onUndoOrRedo:(NSNotification *)aNote
{
[self clearResults];
}
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNote
{

View File

@ -85,6 +85,7 @@
- (void) onRowClicked:(NSNotification *)aNote;
- (void) onBlur:(NSNotification *)aNote;
- (void) onResize:(NSNotification *)aNote;
- (void) onUndoOrRedo:(NSNotification *)aNote;
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
- (id) fieldEditor;

View File

@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
NS_IF_ADDREF(mListener);
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setDelegate: self];
// XXX the owner of the textfield should set this
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
name:NSWindowDidResizeNotification object:nil];
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidRedoChangeNotification
object:[[self fieldEditor] undoManager]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidUndoChangeNotification
object:[[self fieldEditor] undoManager]];
// read the user default on if we should auto-complete the text field as the user
// types or make them pick something from a list (a-la mozilla).
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self resizePopup];
}
- (void) onUndoOrRedo:(NSNotification *)aNote
{
[self clearResults];
}
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNote
{

View File

@ -85,6 +85,7 @@
- (void) onRowClicked:(NSNotification *)aNote;
- (void) onBlur:(NSNotification *)aNote;
- (void) onResize:(NSNotification *)aNote;
- (void) onUndoOrRedo:(NSNotification *)aNote;
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
- (id) fieldEditor;

View File

@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
NS_IF_ADDREF(mListener);
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setDelegate: self];
// XXX the owner of the textfield should set this
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
name:NSWindowDidResizeNotification object:nil];
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidRedoChangeNotification
object:[[self fieldEditor] undoManager]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidUndoChangeNotification
object:[[self fieldEditor] undoManager]];
// read the user default on if we should auto-complete the text field as the user
// types or make them pick something from a list (a-la mozilla).
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self resizePopup];
}
- (void) onUndoOrRedo:(NSNotification *)aNote
{
[self clearResults];
}
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNote
{

View File

@ -85,6 +85,7 @@
- (void) onRowClicked:(NSNotification *)aNote;
- (void) onBlur:(NSNotification *)aNote;
- (void) onResize:(NSNotification *)aNote;
- (void) onUndoOrRedo:(NSNotification *)aNote;
- (void) setStringUndoably:(NSString*)aString fromLocation:(unsigned int)aLocation;
- (id) fieldEditor;

View File

@ -91,6 +91,7 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
mListener = (nsIAutoCompleteListener *)new AutoCompleteListener(self);
NS_IF_ADDREF(mListener);
[self setFont:[NSFont controlContentFontOfSize:0]];
[self setDelegate: self];
// XXX the owner of the textfield should set this
@ -151,6 +152,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResize:)
name:NSWindowDidResizeNotification object:nil];
// listen for Undo/Redo to make sure autocomplete doesn't get horked.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidRedoChangeNotification
object:[[self fieldEditor] undoManager]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onUndoOrRedo:)
name:NSUndoManagerDidUndoChangeNotification
object:[[self fieldEditor] undoManager]];
// read the user default on if we should auto-complete the text field as the user
// types or make them pick something from a list (a-la mozilla).
mCompleteWhileTyping = [[NSUserDefaults standardUserDefaults] boolForKey:USER_DEFAULTS_AUTOCOMPLETE_WHILE_TYPING];
@ -501,6 +510,11 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
[self resizePopup];
}
- (void) onUndoOrRedo:(NSNotification *)aNote
{
[self clearResults];
}
// NSTextField delegate //////////////////////////////////
- (void)controlTextDidChange:(NSNotification *)aNote
{