зеркало из https://github.com/mozilla/pjs.git
xmlterm changes only (not part of the default build).
Minor tweaks to handle input of control characters. Switched to double clicks, instead of single clicks, to activate XMLterm features (to protect the user).
This commit is contained in:
Родитель
3318ea6a6e
Коммит
c2be5fbacf
|
@ -119,12 +119,18 @@ Note that the prompt and the input command line are clickable.
|
|||
(Of course, the appearance of XMLterm is completely configurable
|
||||
using the CSS stylesheet chrome://xmlterm/skin/default/xmltpage.css)
|
||||
|
||||
After typing one or two commands, click on the prompt string of any previous
|
||||
command to see what happens! Then click again on the same prompt string.
|
||||
Also click on "Hide all output" button at the top of the document.
|
||||
Double-clicking is used to activate all XMLterm features, except for
|
||||
underlined hyperlinks, which are activated by a single click as in a browser.
|
||||
|
||||
Clicking on a previous command line (to the right of the prompt) re-executes
|
||||
the command.
|
||||
After typing one or two commands, double-click on the prompt string of any
|
||||
previous command to see what happens! Then double-click again on the same
|
||||
prompt string. Also click on "Hide all output" button at the top of the
|
||||
document.
|
||||
|
||||
Double-clicking on a previous command line (to the right of the prompt)
|
||||
re-executes the command. Be warned that double-clicking a command line can
|
||||
profoundly affect your computing environment, depending upon what the command
|
||||
is.
|
||||
|
||||
The sample Perl script "xls", the iconic/hypertext version of the Unix "ls"
|
||||
command, is in the "scripts" directory. Also in the "scripts" directory
|
||||
|
|
|
@ -45,7 +45,8 @@ static int ltermWrite(struct lterms *lts, int *opcodes);
|
|||
static int ltermReturnStreamData(struct lterms *lts, struct LtermRead *ltr);
|
||||
static int ltermReturnScreenData(struct lterms *lts, struct LtermRead *ltr,
|
||||
int opcodes, int opvals, int oprow);
|
||||
static int ltermReturnInputLine(struct lterms *lts, struct LtermRead *ltr);
|
||||
static int ltermReturnInputLine(struct lterms *lts, struct LtermRead *ltr,
|
||||
int completionRequested);
|
||||
static int ltermReturnOutputLine(struct lterms *lts, struct LtermRead *ltr);
|
||||
|
||||
|
||||
|
@ -578,7 +579,7 @@ int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout)
|
|||
|
||||
if (inOpcodes != 0) {
|
||||
/* Echoable input data processed; return input line */
|
||||
returnCode = ltermReturnInputLine(lts, ltr);
|
||||
returnCode = ltermReturnInputLine(lts, ltr, 0);
|
||||
if (returnCode < 0)
|
||||
return returnCode;
|
||||
|
||||
|
@ -664,6 +665,9 @@ int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout)
|
|||
if (returnCode < 0)
|
||||
return returnCode;
|
||||
|
||||
LTERM_LOG(ltermRead,33, ("read_count=%d, echoChars=%d\n",
|
||||
ltr->read_count, lts->echoChars));
|
||||
|
||||
if (lts->inputLineBreak) {
|
||||
/* Compare output line to initial portion of echo line */
|
||||
echoMatch = 1;
|
||||
|
@ -741,7 +745,7 @@ int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout)
|
|||
}
|
||||
|
||||
/* Return updated input line, prefixed with prompt */
|
||||
returnCode = ltermReturnInputLine(lts, ltr);
|
||||
returnCode = ltermReturnInputLine(lts, ltr, 1);
|
||||
if (returnCode < 0)
|
||||
return returnCode;
|
||||
|
||||
|
@ -756,7 +760,7 @@ int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout)
|
|||
LTERM_LOG(ltermRead,32,("Prompt-only line\n"));
|
||||
|
||||
/* Return updated input line, prefixed with prompt */
|
||||
returnCode = ltermReturnInputLine(lts, ltr);
|
||||
returnCode = ltermReturnInputLine(lts, ltr, 0);
|
||||
if (returnCode < 0)
|
||||
return returnCode;
|
||||
}
|
||||
|
@ -1053,13 +1057,15 @@ static int ltermReturnScreenData(struct lterms *lts, struct LtermRead *ltr,
|
|||
/** Returns incomplete input line, prefixed with prompt or incomplete output.
|
||||
* (Auxiliary procedure for ltermRead.)
|
||||
* The LtermRead structure *LTR contains both input and output parameters.
|
||||
* Set COMPLETIONREQUESTED to true if this is a completed command line.
|
||||
* @return 0 if successful,
|
||||
* -1 if an error occurred while reading,
|
||||
* -3 if more than COUNT characters are present in the line
|
||||
* (in this case the first COUNT characters are returned in BUF,
|
||||
* and the rest are discarded).
|
||||
*/
|
||||
static int ltermReturnInputLine(struct lterms *lts, struct LtermRead *ltr)
|
||||
static int ltermReturnInputLine(struct lterms *lts, struct LtermRead *ltr,
|
||||
int completionRequested)
|
||||
{
|
||||
struct LtermOutput *lto = &(lts->ltermOutput);
|
||||
struct LtermInput *lti = &(lts->ltermInput);
|
||||
|
@ -1070,10 +1076,16 @@ static int ltermReturnInputLine(struct lterms *lts, struct LtermRead *ltr)
|
|||
lto->outputChars, lto->promptChars));
|
||||
|
||||
if (lto->promptChars > 0) {
|
||||
/* Prefix with prompt portion of output only */
|
||||
/* Prefix with prompt output data */
|
||||
ltr->opcodes = LTERM_LINEDATA_CODE;
|
||||
|
||||
outChars = lto->promptChars;
|
||||
if (completionRequested) {
|
||||
outChars = lto->promptChars;
|
||||
} else {
|
||||
/* Hack to handle misidentified prompts */
|
||||
outChars = lto->outputChars;
|
||||
}
|
||||
|
||||
if (outChars > ltr->max_count)
|
||||
outChars = 0;
|
||||
|
||||
|
|
|
@ -421,6 +421,11 @@ static int ltermLineInput(struct lterms *lts,
|
|||
} else {
|
||||
/* Control character */
|
||||
|
||||
/* Translate carriage returns to linefeeds in line mode
|
||||
(***NOTE*** may not be portable out of *nix) */
|
||||
if (uch == U_CRETURN)
|
||||
uch = U_LINEFEED;
|
||||
|
||||
/* Line break control characters */
|
||||
if ( (uch == U_LINEFEED) ||
|
||||
(uch == lts->control[TTYDISCARD]) ||
|
||||
|
@ -484,13 +489,14 @@ static int ltermLineInput(struct lterms *lts,
|
|||
|
||||
LTERM_LOG(ltermLineInput,31,("TTYKILL\n"));
|
||||
|
||||
} else if ((uch == U_BACKSPACE) ||
|
||||
} else if ((uch == U_BACKSPACE) || (uch == U_DEL) ||
|
||||
(uch == lts->control[TTYERASE])) {
|
||||
/* erase glyph */
|
||||
if (ltermDeleteGlyphs(lti, 1) != 0)
|
||||
return -1;
|
||||
|
||||
LTERM_LOG(ltermLineInput,39,("TTYERASE\n"));
|
||||
LTERM_LOG(ltermLineInput,39,("TTYERASE=%x/%x\n",
|
||||
lts->control[TTYERASE], uch ));
|
||||
|
||||
} else {
|
||||
/* other control characters */
|
||||
|
@ -542,10 +548,8 @@ static int ltermLineInput(struct lterms *lts,
|
|||
case U_CTL_Y: /* yank */
|
||||
case U_TAB: /* command completion */
|
||||
|
||||
if ( (lti->inputChars == 0) && (uch == U_CTL_D) &&
|
||||
!((lts->processType == LTERM_TCSH_PROCESS) &&
|
||||
(lti->inputMode >= LTERM3_COMPLETION_MODE)) ) {
|
||||
/* If lone ^D and not TCSH completion, simply transmit it */
|
||||
if ((lti->inputChars == 0) && (uch == U_CTL_D)) {
|
||||
/* If lone ^D input, simply transmit it */
|
||||
if (ltermSendData(lts, &uch, 1) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
|
|
|
@ -294,14 +294,16 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
break; // ignore modifier key event
|
||||
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
|
||||
case nsIDOMKeyEvent::DOM_VK_DELETE:
|
||||
keyChar = U_BACKSPACE;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_DELETE:
|
||||
keyChar = U_DEL;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_TAB:
|
||||
keyChar = U_TAB;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_RETURN:
|
||||
keyChar = U_LINEFEED;
|
||||
keyChar = U_CRETURN;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_LEFT:
|
||||
keyChar = U_CTL_B;
|
||||
|
@ -341,9 +343,10 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
}
|
||||
|
||||
} else if ((ctrlKey == PR_TRUE) && (altKey == PR_FALSE) &&
|
||||
(keyChar > 0x60U) && (keyChar < 0xA0U)) {
|
||||
(keyChar >= 0x40U) && (keyChar < 0x80U)) {
|
||||
// Control character, without Alt; adjust character code
|
||||
keyChar = keyChar - 0x60U; // Is this portable?
|
||||
// Is this portable?
|
||||
keyChar = (keyChar >= 0x60U) ? keyChar-0x60U : keyChar-0x40U;
|
||||
}
|
||||
|
||||
if (JSCommand.Length() > 0) {
|
||||
|
@ -364,8 +367,6 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
JSOutput);
|
||||
}
|
||||
}
|
||||
// Translate Carriage Return to LineFeed (may not be portable??)
|
||||
if (keyChar == U_CRETURN) keyChar = U_LINEFEED;
|
||||
|
||||
if (!mSuspend && (keyChar > 0) && (keyChar <= 0xFFFDU)) {
|
||||
// Transmit valid non-null Unicode character
|
||||
|
|
|
@ -56,12 +56,19 @@ XMLterm installation instructions for Linux binaries
|
|||
(Of course, the appearance of XMLterm is completely configurable
|
||||
using the CSS stylesheet chrome://xmlterm/skin/default/xmlterm.css)
|
||||
|
||||
After typing one or two commands, click on the prompt string of any previous
|
||||
command to see what happens! Then click again on the same prompt string.
|
||||
Also click on "Hide all output" button at the top of the document.
|
||||
Double-clicking is used to activate all XMLterm features, except for
|
||||
underlined hyperlinks, which are activated by a single click as in a
|
||||
browser.
|
||||
|
||||
Clicking on a previous command line (to the right of the prompt) re-executes
|
||||
the command.
|
||||
After typing one or two commands, double-click on the prompt string of any
|
||||
previous command to see what happens! Then double-click again on the same
|
||||
prompt string. Also click on "Hide all output" button at the top of the
|
||||
document.
|
||||
|
||||
Double-clicking on a previous command line (to the right of the prompt)
|
||||
re-executes the command. Be warned that double-clicking a command line can
|
||||
profoundly affect your computing environment, depending upon what the
|
||||
command is.
|
||||
|
||||
7. The sample Perl script "xls", the iconic/hypertext version of the Unix "ls"
|
||||
command, is in the "package" directory. Also in the "package" directory
|
||||
|
|
|
@ -33,8 +33,8 @@ while (<INFILE>) {
|
|||
print OUTFILE;
|
||||
}
|
||||
}
|
||||
close <INFILE>;
|
||||
close <OUTFILE>;
|
||||
close INFILE;
|
||||
close OUTFILE;
|
||||
|
||||
rename $menufile, "$menufile.bak";
|
||||
rename "$menufile.new", $menufile;
|
||||
|
|
|
@ -63,12 +63,20 @@ foreach $file (glob("*")) { # for each file in current directory
|
|||
$sendtxt1 = "$dir/$file";
|
||||
$sendtxt2 = "./$file";
|
||||
|
||||
} elsif (($extension eq ".gif") || ($extension eq ".png") || ($extension eq ".jpg")) { # image
|
||||
} elsif (($extension eq ".gif") ||
|
||||
($extension eq ".png") ||
|
||||
($extension eq ".jpg")) { # image
|
||||
$filetype = "imagefile";
|
||||
$fileimg = "file://$dir/$file";
|
||||
$sendtxt1 = "xcat $dir/$file";
|
||||
$sendtxt2 = "xcat $file";
|
||||
|
||||
} elsif ($extension eq ".ps") { # postscript
|
||||
$filetype = "plainfile";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendtxt1 = "ghostview $dir/$file &";
|
||||
$sendtxt2 = "ghostview $file &";
|
||||
|
||||
} elsif ($extension eq ".url") { # URL
|
||||
open INFILE, $file or next;
|
||||
$_ = <INFILE>;
|
||||
|
|
|
@ -179,10 +179,23 @@
|
|||
|
||||
// Entry independent targets
|
||||
if (action === "textlink") {
|
||||
// Single click opens hyperlink
|
||||
// Browser-style
|
||||
dump("textlink = "+arg1+"\n");
|
||||
Load(arg1);
|
||||
|
||||
} else if (eventType === "click") {
|
||||
|
||||
dump("clickCount="+eventObj.clickCount+"\n");
|
||||
|
||||
var dblClick = (eventObj.clickCount > 1);
|
||||
|
||||
// Execute shell commands only on double-click for safety
|
||||
// Use single click for "selection" only
|
||||
// Windows-style
|
||||
if (!dblClick)
|
||||
return false;
|
||||
|
||||
if (targetType === "prompt") {
|
||||
var outputElement = document.getElementById("output"+entryNumber);
|
||||
var promptElement = document.getElementById("prompt"+entryNumber);
|
||||
|
@ -199,7 +212,6 @@
|
|||
} else if (targetType === "command") {
|
||||
var commandElement = document.getElementById(targetType+entryNumber);
|
||||
var command = commandElement.firstChild.data;
|
||||
dump("command = "+command+"\n\n");
|
||||
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -322,7 +322,7 @@
|
|||
function LoadHandler() {
|
||||
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
|
||||
|
||||
//UsageTip();
|
||||
UsageTip();
|
||||
|
||||
if (window.xmlterm) {
|
||||
// XMLTerm already initialized
|
||||
|
@ -420,7 +420,32 @@
|
|||
|
||||
<BODY onLoad="return LoadHandler();">
|
||||
|
||||
<HR>
|
||||
<TABLE FRAME=none BORDER=0>
|
||||
<TBODY>
|
||||
<TR><TD ALIGN=center>
|
||||
<FORM NAME="XMLTERM form">
|
||||
<INPUT TYPE="button" VALUE="Hide all output"
|
||||
onClick="return HideAll();">
|
||||
<INPUT TYPE="button" VALUE="Show all output"
|
||||
onClick="return ShowAll();">
|
||||
<INPUT TYPE="button" VALUE="SetHistory"
|
||||
onClick="return SetHistoryValue();">
|
||||
<INPUT TYPE="button" VALUE="SetPrompt" onClick="return SetPromptValue();">
|
||||
<INPUT TYPE="button" VALUE="NewXMLTerm" onClick="return NewXMLTerm('');">
|
||||
<BR>
|
||||
Input Value:
|
||||
<INPUT SIZE=50 TYPE="text" ID="InputValue"
|
||||
VALUE="<img src='http:/dmoz.org/img/lizard2a.gif'>"
|
||||
onFocus="return FormFocus();" onBlur="return FormBlur();">
|
||||
</FORM>
|
||||
</TABLE>
|
||||
|
||||
<SPAN CLASS="tiphead" ID="tiphead" STYLE="font-weight:bold"> </SPAN>
|
||||
<SPAN CLASS="tipdata" ID="tipdata"> </SPAN>
|
||||
|
||||
<SPAN CLASS="moretips" ID="moretips" onClick="return MoreTips();">
|
||||
More tips/news
|
||||
</SPAN>
|
||||
<P>
|
||||
<!--
|
||||
<IFRAME NAME="iframet" SRC="chrome://xmlterm/content/xmltblank.html"
|
||||
|
|
|
@ -36,6 +36,6 @@
|
|||
html:src="about:blank" flex="100%"/>
|
||||
|
||||
<html:iframe id="content-frame" type="content" html:name="content"
|
||||
html:src="chrome://xmlterm/content/xmlterm2.html" flex="100%"/>
|
||||
html:src="chrome://xmlterm/content/xmlterm.html" flex="100%"/>
|
||||
|
||||
</window>
|
||||
|
|
Загрузка…
Ссылка в новой задаче