Index: src/kits/locale/Jamfile
===================================================================
--- src/kits/locale/Jamfile	(revision 39940)
+++ src/kits/locale/Jamfile	(working copy)
@@ -67,6 +67,7 @@
 SEARCH on [ FGristFiles StringForSize.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ;
 SEARCH on [ FGristFiles AboutWindow.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ;
 SEARCH on [ FGristFiles ColorControl.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
+SEARCH on [ FGristFiles TextInput.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
 
 DoCatalogs liblocale.so
 	: system
@@ -74,4 +75,5 @@
 	AboutWindow.cpp
 	ColorControl.cpp
 	StringForSize.cpp
+	TextInput.cpp	
 	;
Index: src/kits/interface/TextInput.h
===================================================================
--- src/kits/interface/TextInput.h	(revision 39940)
+++ src/kits/interface/TextInput.h	(working copy)
@@ -46,8 +46,10 @@
 virtual	void			InsertText(const char *inText, int32 inLength,
 								   int32 inOffset, const text_run_array *inRuns);
 virtual	void			DeleteText(int32 fromOffset, int32 toOffset);
+virtual	void			MessageReceived(BMessage* message);
 
 private:
+		void			_Init();
 
 		BTextControl	*TextControl();
 
Index: src/kits/interface/TextInput.cpp
===================================================================
--- src/kits/interface/TextInput.cpp	(revision 39940)
+++ src/kits/interface/TextInput.cpp	(working copy)
@@ -14,25 +14,46 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <Clipboard.h>
 #include <ControlLook.h>
 #include <InterfaceDefs.h>
+#include <LayoutBuilder.h>
 #include <LayoutUtils.h>
+#include <Menu.h>
+#include <MenuItem.h>
 #include <Message.h>
+#include <PopUpMenu.h>
 #include <String.h>
 #include <TextControl.h>
 #include <TextView.h>
 #include <Window.h>
 
+#include <Catalog.h>
+#include <LocaleBackend.h>
 
+
+using BPrivate::gLocaleBackend;
+using BPrivate::LocaleBackend;
+
+
+#undef B_TRANSLATE_CONTEXT
+#define B_TRANSLATE_CONTEXT "TextInput"
+
+
+#define TRANSLATE(str) gLocaleBackend->GetString(B_TRANSLATE_MARK(str), \
+		"TextInput")
+
+
 namespace BPrivate {
 
+const uint32 kMsgClearInput = 'CLER';
 
 _BTextInput_::_BTextInput_(BRect frame, BRect textRect, uint32 resizeMask,
 		uint32 flags)
 	: BTextView(frame, "_input_", textRect, resizeMask, flags),
 	fPreviousText(NULL)
 {
-	MakeResizable(true);
+	_Init();
 }
 
 
@@ -40,7 +61,7 @@
 	: BTextView(archive),
 	fPreviousText(NULL)
 {
-	MakeResizable(true);
+	_Init();
 }
 
 
@@ -75,8 +96,50 @@
 		return;
 	}
 
-	// only pass through to base class if we already have focus
-	BTextView::MouseDown(where);
+	int32 buttons = B_SECONDARY_MOUSE_BUTTON;
+	if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
+		Looper()->CurrentMessage()->FindInt32("buttons", &buttons);
+
+	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
+		bool isRedo;
+		undo_state state = UndoState(&isRedo);
+		bool isUndo = state != B_UNDO_UNAVAILABLE && !isRedo;
+
+		int32 start;
+		int32 finish;
+		GetSelection(&start, &finish);
+		
+		bool canEdit = IsEditable();
+		int32 length = TextLength();
+	
+		BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
+
+		BLayoutBuilder::Menu<>(menu)
+			.AddItem(TRANSLATE("Undo"), B_UNDO/*, 'Z'*/)
+				.SetEnabled(canEdit && isUndo)
+			.AddItem(TRANSLATE("Redo"), B_UNDO/*, 'Z', B_SHIFT_KEY*/)
+				.SetEnabled(canEdit && isRedo)
+			.AddSeparator()
+			.AddItem(TRANSLATE("Cut"), B_CUT, 'X')
+				.SetEnabled(canEdit && start != finish)
+			.AddItem(TRANSLATE("Copy"), B_COPY, 'C')
+				.SetEnabled(start != finish)
+			.AddItem(TRANSLATE("Paste"), B_PASTE, 'V')
+				.SetEnabled(canEdit && be_clipboard->SystemCount() > 0)
+			.AddSeparator()
+			.AddItem(TRANSLATE("Select All"), B_SELECT_ALL, 'A')
+				.SetEnabled(!(start == 0 && finish == length))
+			.AddItem(TRANSLATE("Clear"), kMsgClearInput)
+				.SetEnabled(canEdit && length > 0)
+		;
+
+		menu->SetTargetForItems(this);
+		ConvertToScreen(&where);
+		menu->Go(where, true, true,	true);
+	} else {
+		// only pass through to base class if we already have focus
+		BTextView::MouseDown(where);
+	}
 }
 
 
@@ -118,6 +181,7 @@
 	}
 }
 
+
 void
 _BTextInput_::MakeFocus(bool state)
 {
@@ -249,5 +313,33 @@
 }
 
 
+void
+_BTextInput_::MessageReceived(BMessage* message)
+{
+	switch(message->what) {
+		case kMsgClearInput:
+			SelectAll();
+			Clear();
+			break;
+
+		default:
+			BTextView::MessageReceived(message);
+			break;
+	}
+}
+
+
+void
+_BTextInput_::_Init()
+{
+	// we need to translate some strings, and in order to do so, we need
+	// to use the LocaleBackend to reache liblocale.so
+	if (gLocaleBackend == NULL)
+		LocaleBackend::LoadBackend();
+
+	MakeResizable(true);
+}
+
+
 }	// namespace BPrivate
 
