diff --git a/extensions/xmlterm/base/mozXMLTermSession.cpp b/extensions/xmlterm/base/mozXMLTermSession.cpp index 39d0d0e2c69..ee9a2de0ea7 100644 --- a/extensions/xmlterm/base/mozXMLTermSession.cpp +++ b/extensions/xmlterm/base/mozXMLTermSession.cpp @@ -155,7 +155,6 @@ mozXMLTermSession::mozXMLTermSession() : mBotScrollRow(0), mRestoreInputEcho(false), - mNeedsResizing(false), mShellPrompt(""), mPromptHTML(""), @@ -285,17 +284,6 @@ NS_IMETHODIMP mozXMLTermSession::Finalize(void) } -/** Sets XMLTerm flag to indicate XMLTerm needs to be resized - */ -NS_IMETHODIMP mozXMLTermSession::NeedsResizing(void) -{ - XMLT_LOG(mozXMLTermSession::NeedsResizing,0,("\n")); - - mNeedsResizing = true; - - return NS_OK; -} - /** Resizes XMLterm to match a resized window. * @param lineTermAux LineTermAux object to be resized (may be null) */ @@ -338,14 +326,17 @@ NS_IMETHODIMP mozXMLTermSession::Resize(mozILineTermAux* lineTermAux) /** Preprocesses user input before it is transmitted to LineTerm * @param aString (inout) input data to be preprocessed * @param consumed (output) true if input data has been consumed + * @param checkSize (output) true if terminal size needs to be checked */ NS_IMETHODIMP mozXMLTermSession::Preprocess(const nsString& aString, - PRBool& consumed) + PRBool& consumed, + PRBool& checkSize) { XMLT_LOG(mozXMLTermSession::Preprocess,70,("\n")); consumed = false; + checkSize = false; if (mMetaCommandType == TREE_META_COMMAND) { if (aString.Length() == 1) { @@ -400,6 +391,15 @@ NS_IMETHODIMP mozXMLTermSession::Preprocess(const nsString& aString, break; } } + } else { + + if ((mScreenNode == nsnull) && + (aString.FindCharInSet("\r\n\017") >= 0)) { + // C-Return or Newline or Control-O found in string; not screen mode; + // resize terminal, if need be + checkSize = true; + XMLT_LOG(mozXMLTermSession::Preprocess,72,("checkSize\n")); + } } return NS_OK; @@ -719,6 +719,8 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux, result = PositionScreenCursor(cursorRow, cursorCol); + flushOutput = false; + } else { // Process line data PRBool promptLine, inputLine, metaCommand, completionRequested; @@ -990,14 +992,13 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux, result = NewEntry(promptStr); if (NS_FAILED(result)) break; - } - // Resize XMLTerm before command output, if request has been made - if (mNeedsResizing) { - mNeedsResizing = false; - result = Resize(lineTermAux); - if (NS_FAILED(result)) - break; + if (mCurrentEntryNumber == mStartEntryNumber) { + // First entry; resize terminal + result = Resize(lineTermAux); + if (NS_FAILED(result)) + break; + } } // Display input and position cursor diff --git a/extensions/xmlterm/base/mozXMLTermSession.h b/extensions/xmlterm/base/mozXMLTermSession.h index b31169b2e99..a3c7aae02c0 100644 --- a/extensions/xmlterm/base/mozXMLTermSession.h +++ b/extensions/xmlterm/base/mozXMLTermSession.h @@ -64,10 +64,6 @@ class mozXMLTermSession */ NS_IMETHOD Finalize(void); - /** Sets XMLTerm flag to indicate XMLTerm needs to be resized - */ - NS_IMETHOD NeedsResizing(void); - /** Resizes XMLterm to match a resized window. * @param lineTermAux LineTermAux object to be resized (may be null) */ @@ -76,8 +72,11 @@ class mozXMLTermSession /** Preprocesses user input before it is transmitted to LineTerm * @param aString (inout) input data to be preprocessed * @param consumed (output) true if input data has been consumed + * @param checkSize (output) true if terminal size needs to be checked */ - NS_IMETHOD Preprocess(const nsString& aString, PRBool& consumed); + NS_IMETHOD Preprocess(const nsString& aString, + PRBool& consumed, + PRBool& checkSize); /** Reads all available data from LineTerm and displays it; * returns when no more data is available. @@ -700,9 +699,6 @@ protected: /** restore input echo flag */ PRBool mRestoreInputEcho; - /** needs resizing flag */ - PRBool mNeedsResizing; - /** shell prompt string */ nsString mShellPrompt; diff --git a/extensions/xmlterm/base/mozXMLTerminal.cpp b/extensions/xmlterm/base/mozXMLTerminal.cpp index e24adcff46d..1b17c696754 100644 --- a/extensions/xmlterm/base/mozXMLTerminal.cpp +++ b/extensions/xmlterm/base/mozXMLTerminal.cpp @@ -109,6 +109,7 @@ mozXMLTerminal::mozXMLTerminal() : mXMLTermSession(nsnull), mLineTermAux(nsnull), + mNeedsResizing(false), mKeyListener(nsnull), mTextListener(nsnull), @@ -507,11 +508,6 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void) // Save cookie mCookie = cookie; - // Resize XMLterm (before displaying any output) - result = Resize(); - if (NS_FAILED(result)) - return result; - // Get the DOM event receiver for document nsCOMPtr eventReceiver; result = mDOMDocument->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), @@ -642,12 +638,12 @@ NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32& rows, PRInt32& cols, xdel = pixelScale * fontWidth; ydel = pixelScale * fontHeight + 2; - xPixels = (int) (pixelScale * shellArea.height); - yPixels = (int) (pixelScale * shellArea.width); + xPixels = (int) (pixelScale * shellArea.width); + yPixels = (int) (pixelScale * shellArea.height); // Determine number of rows/columns - rows = (int) ((xPixels-44) / ydel); - cols = (int) ((yPixels-20) / xdel); + rows = (int) ((yPixels-16) / ydel); + cols = (int) ((xPixels-20) / xdel); if (rows < 1) rows = 1; if (cols < 1) cols = 1; @@ -679,8 +675,17 @@ NS_IMETHODIMP mozXMLTerminal::SendText(const nsString& aString, nsAutoString sendStr = aString; // Preprocess string and check if it is to be consumed - PRBool consumed = false; - result = mXMLTermSession->Preprocess(sendStr, consumed); + PRBool consumed, checkSize; + result = mXMLTermSession->Preprocess(sendStr, consumed, checkSize); + + PRBool screenMode; + GetScreenMode(&screenMode); + + if (!screenMode && (checkSize || mNeedsResizing)) { + // Resize terminal, if need be + mXMLTermSession->Resize(mLineTermAux); + mNeedsResizing = false; + } if (!consumed) { result = mLineTermAux->Write(sendStr.GetUnicode(), aCookie); @@ -907,10 +912,18 @@ NS_IMETHODIMP mozXMLTerminal::Resize(void) if (!mXMLTermSession) return NS_ERROR_FAILURE; - // Delay resizing until next command output display - result = mXMLTermSession->NeedsResizing(); - if (NS_FAILED(result)) - return result; + PRBool screenMode; + GetScreenMode(&screenMode); + + if (screenMode) { + // Delay resizing until next input processing + mNeedsResizing = true; + } else { + // Resize session + result = mXMLTermSession->Resize(mLineTermAux); + if (NS_FAILED(result)) + return result; + } return NS_OK; } diff --git a/extensions/xmlterm/base/mozXMLTerminal.h b/extensions/xmlterm/base/mozXMLTerminal.h index 979a4b8b6d2..e4f42650eef 100644 --- a/extensions/xmlterm/base/mozXMLTerminal.h +++ b/extensions/xmlterm/base/mozXMLTerminal.h @@ -136,6 +136,9 @@ class mozXMLTerminal : public mozIXMLTerminal, /** owning reference to LineTermAux object created by us */ nsCOMPtr mLineTermAux; + /** terminal needs resizing flag */ + PRBool mNeedsResizing; + /** owning referencing to key listener object created by us */ nsCOMPtr mKeyListener; diff --git a/extensions/xmlterm/ui/content/XMLTermCommands.js b/extensions/xmlterm/ui/content/XMLTermCommands.js index 97d191fb707..f031bdf7cd8 100644 --- a/extensions/xmlterm/ui/content/XMLTermCommands.js +++ b/extensions/xmlterm/ui/content/XMLTermCommands.js @@ -418,6 +418,7 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber, dump("clickCount="+eventObj.clickCount+"\n"); + var shiftClick = eventObj.shiftKey; var dblClick = (eventObj.clickCount == 2); // Execute shell commands only on double-click for safety @@ -497,7 +498,7 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber, suffix = ""; } - if (window.windowsMode === "on") { + if (shiftClick || (window.windowsMode === "on")) { action = "createln"; sendStr = prefix + filename + suffix; diff --git a/extensions/xmlterm/ui/content/xmlterm.xul b/extensions/xmlterm/ui/content/xmlterm.xul index d284b8cf0c4..e69de29bb2d 100644 --- a/extensions/xmlterm/ui/content/xmlterm.xul +++ b/extensions/xmlterm/ui/content/xmlterm.xul @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - -