From 05c2f451dcbb7fdfb6d45d8b65ec71ba6b799af4 Mon Sep 17 00:00:00 2001
From: "Matthew Breindel (Falcon)" <falcon@lindenlab.com>
Date: Wed, 22 Sep 2010 13:01:17 -0700
Subject: Minor fixes to simulator console.

---
 indra/llui/lllineeditor.cpp                        |  6 +--
 indra/newview/llfloaterregiondebugconsole.cpp      | 43 +++++++++++++++++-----
 .../xui/en/floater_region_debug_console.xml        | 10 +++--
 3 files changed, 44 insertions(+), 15 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index c0cc294c02..6564158ccc 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1276,7 +1276,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 
 	// handle ctrl-uparrow if we have a history enabled line editor.
 	case KEY_UP:
-		if( mHaveHistory && ( MASK_CONTROL == mask ) )
+		if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) )
 		{
 			if( mCurrentHistoryLine > mLineHistory.begin() )
 			{
@@ -1291,9 +1291,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 		}
 		break;
 
-	// handle ctrl-downarrow if we have a history enabled line editor
+	// handle [ctrl]-downarrow if we have a history enabled line editor
 	case KEY_DOWN:
-		if( mHaveHistory  && ( MASK_CONTROL == mask ) )
+		if( mHaveHistory  && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) )
 		{
 			if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 )
 			{
diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp
index 8885fa0cb1..159dee7631 100644
--- a/indra/newview/llfloaterregiondebugconsole.cpp
+++ b/indra/newview/llfloaterregiondebugconsole.cpp
@@ -55,9 +55,8 @@ public:
     /*virtual*/
     void result(const LLSD& content)
     {
-        std::string text = content.asString();
-        text += '\n';
-        mOutput->appendText(text, true);
+		std::string text = content.asString() + "\n\n> ";
+		mOutput->appendText(text, false);
     };
 
     LLTextEditor * mOutput;
@@ -70,20 +69,46 @@ LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key)
 
 BOOL LLFloaterRegionDebugConsole::postBuild()
 {
-	getChild<LLLineEditor>("region_debug_console_input")->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2));
+	LLLineEditor* input = getChild<LLLineEditor>("region_debug_console_input");
+	input->setEnableLineHistory(true);
+	input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2));
+	input->setFocus(true);
+	input->setCommitOnFocusLost(false);
+
 	mOutput = getChild<LLTextEditor>("region_debug_console_output");
+
+	std::string url = gAgent.getRegion()->getCapability("SimConsole");
+	if ( url.size() == 0 )
+	{
+		mOutput->appendText("This region does not support the simulator console.\n\n> ", false);
+	}
+	else
+	{
+		mOutput->appendText("> ", false);
+	}
+	
+
 	return TRUE;
 }
 
 void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param)
 {
-	LLLineEditor * input = static_cast<LLLineEditor*>(ctrl);
-	std::string text = "\\POST: ";
-	text += input->getText();
-	mOutput->appendText(text, true);
+	LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
+	std::string text = input->getText() + "\n";
+
 
     std::string url = gAgent.getRegion()->getCapability("SimConsole");
-    LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput));
+
+	if ( url.size() > 0 )
+	{
+		LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput));
+	}
+	else
+	{
+		text += "\nError: No console available for this region/simulator.\n\n> ";
+	}
+
+	mOutput->appendText(text, false);
 
 	input->clear();
 }
diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
index 591d77340a..cf95257b0a 100644
--- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
@@ -6,7 +6,8 @@
   min_height="300"
   min_width="300"
   height="400"
-  width="600">
+  width="600"
+  default_tab_group="1">
   <text_editor
   left="10"
    type="string"
@@ -20,11 +21,14 @@
    max_length="65536"
    name="region_debug_console_output"
    show_line_numbers="false" 
-   word_wrap="true">
+   word_wrap="true"
+   track_end="true"
+   read_only="true">
   </text_editor>
   <line_editor
    border_style="line"
    border_thickness="1"
+   tab_group="1" 
    follows="left|top|right"
    font="SansSerif"
    height="19"
@@ -33,5 +37,5 @@
    max_length="127"
    name="region_debug_console_input"
    top_delta="0"
-   width="394" />
+   width="576" />
 </floater>
-- 
cgit v1.2.3