diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index f51f1f97c9..fd2b2f49da 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Andrea Anzani - * Copyright (C) 2007 Ryan Leavengood + * Copyright (C) 2007, 2010 Ryan Leavengood * Copyright (C) 2009 Maxime Simon * Copyright (C) 2010 Stephan Aßmus * Copyright (C) 2010 Michael Lotz @@ -546,8 +546,12 @@ BrowserWindow::DispatchMessage(BMessage* message, BHandler* target) PostMessage(GO_FORWARD); return; } else if (bytes[0] == B_ESCAPE) { - PostMessage(STOP); - return; + // Let the URL input handle escape when it is the target + if (target != fURLInputGroup->TextView()) { + // Otherwise do a stop + PostMessage(STOP); + return; + } } else if (bytes[0] == B_FUNCTION_KEY) { // Some function key Firefox compatibility int32 key; diff --git a/src/apps/webpositive/autocompletion/TextViewCompleter.cpp b/src/apps/webpositive/autocompletion/TextViewCompleter.cpp index 4e76f7255a..cdde7ffc66 100644 --- a/src/apps/webpositive/autocompletion/TextViewCompleter.cpp +++ b/src/apps/webpositive/autocompletion/TextViewCompleter.cpp @@ -73,8 +73,7 @@ TextViewCompleter::TextViewCompleter(BTextView* textView, ChoiceModel* model, new BDefaultChoiceView(), patternSelector), BMessageFilter(B_KEY_DOWN), fTextView(textView), - fModificationsReported(false), - fOriginalTextSaved(false) + fModificationsReported(false) { fTextView->AddFilter(this); } @@ -103,11 +102,6 @@ TextViewCompleter::TextModified(bool updateChoices) filter_result TextViewCompleter::Filter(BMessage* message, BHandler** target) { - if (!fOriginalTextSaved) { - fOriginalText = fTextView->Text(); - fOriginalTextSaved = true; - } - const char* bytes; int32 modifiers; if (!target || message->FindString("bytes", &bytes) != B_OK @@ -146,14 +140,8 @@ TextViewCompleter::Filter(BMessage* message, BHandler** target) } case B_ESCAPE: - if (fOriginalText != fTextView->Text()) { - fModificationsReported = false; - fTextView->SetText(fOriginalText.String()); - fTextView->SelectAll(); - fModificationsReported = true; - CancelChoice(); - } - return B_SKIP_MESSAGE; + CancelChoice(); + return B_DISPATCH_MESSAGE; case B_RETURN: if (IsChoiceSelected()) { ApplyChoice(); diff --git a/src/apps/webpositive/autocompletion/TextViewCompleter.h b/src/apps/webpositive/autocompletion/TextViewCompleter.h index aeda86a7f0..1a2955f6d7 100644 --- a/src/apps/webpositive/autocompletion/TextViewCompleter.h +++ b/src/apps/webpositive/autocompletion/TextViewCompleter.h @@ -43,8 +43,6 @@ private: private: BTextView* fTextView; bool fModificationsReported; - BString fOriginalText; - bool fOriginalTextSaved; }; #endif // TEXT_CONTROL_COMPLETER_H