зеркало из https://github.com/mozilla/pjs.git
xmlterm changes only;
Autodetection of window resize at end of input command line.
This commit is contained in:
Родитель
4f3ad54414
Коммит
393312a517
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<nsIDOMEventReceiver> 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;
|
||||
}
|
||||
|
|
|
@ -136,6 +136,9 @@ class mozXMLTerminal : public mozIXMLTerminal,
|
|||
/** owning reference to LineTermAux object created by us */
|
||||
nsCOMPtr<mozILineTermAux> mLineTermAux;
|
||||
|
||||
/** terminal needs resizing flag */
|
||||
PRBool mNeedsResizing;
|
||||
|
||||
/** owning referencing to key listener object created by us */
|
||||
nsCOMPtr<nsIDOMEventListener> mKeyListener;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "MPL"); you may not use this file
|
||||
except in compliance with the MPL. You may obtain a copy of
|
||||
the MPL at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the MPL is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the MPL for the specific language governing
|
||||
rights and limitations under the MPL.
|
||||
|
||||
The Original Code is lineterm.
|
||||
|
||||
The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://xmlterm/skin/xmlterm.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window>
|
||||
<window id="xmlterm-window" xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="StartupXMLTerm();"
|
||||
title="xmlterm" align="vertical" width="586" height="444">
|
||||
|
||||
<html:script src="chrome://xmlterm/content/XMLTermChrome.js"></html:script>
|
||||
|
||||
<html:iframe id="content-frame" type="content" html:name="content"
|
||||
html:src="chrome://xmlterm/content/xmlterm.html" flex="100%"/>
|
||||
|
||||
</window>
|
Загрузка…
Ссылка в новой задаче