Skip to content

Commit e47da22

Browse files
fixed autocomplete on unix, added "w #" command support
1 parent c168218 commit e47da22

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

%WebTerminal/Engine.cls.xml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,28 @@ This method watches only for tail of global and detects if global still alive</D
405405
406406
set data = ##class(%Library.File).ManagerDirectory()
407407
set data = ##class(%Library.File).ParentDirectoryName(data)
408-
set data = data _ "CSP\sys\webTerminal\js\autocomplete\" _
409-
$REPLACE(namespace,"%","_") _ ".js" // UNIX?
408+
409+
set dataTest = ##class(%Library.File).SubDirectoryName(data, "CSP")
410+
if (##class(%Library.File).DirectoryExists(dataTest)) {
411+
set data = ##class(%Library.File).SubDirectoryName(data, "CSP")
412+
} else {
413+
set data = ##class(%Library.File).SubDirectoryName(data, "csp")
414+
}
415+
416+
set data = ##class(%Library.File).SubDirectoryName(data,
417+
$ZCONVERT($REPLACE($namespace,"%",""),"l")
418+
)
419+
set data = ##class(%Library.File).SubDirectoryName(data, "WebTerminal")
420+
set data = ##class(%Library.File).SubDirectoryName(data, "js")
421+
set data = ##class(%Library.File).SubDirectoryName(data, "autocomplete")
422+
set data = ##class(%Library.File).SubDirectoryName(data,
423+
$REPLACE(namespace,"%","_") _ ".js"
424+
)
425+
426+
//set data = data _ "CSP\sys\webTerminal\js\autocomplete\" _
427+
// $REPLACE(namespace,"%","_") _ ".js" // UNIX?
428+
//set data = data _ $REPLACE(namespace,"%","_") _ ".js"
429+
410430
quit data
411431
]]></Implementation>
412432
</Method>

csp/webTerminal/js/terminal.js.xml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,14 @@ var terminal = new function() {
508508
* @param data {string}
509509
*/
510510
this.write = function(data) {
511-
terminal.output.write(data);
511+
512+
// @todo: split to process escape sequence method
513+
//console.log(">" + data + "<");
514+
if (data === String.fromCharCode(12)) { // clearing #
515+
//dom.clearLogs(); // partly wrong: check todo
516+
terminal.output.clear();
517+
//terminal.output.setTarget(dom.objects.output);
518+
} else terminal.output.write(data);
512519
};
513520
514521
};
@@ -977,6 +984,22 @@ var terminal = new function() {
977984
target = object;
978985
return true;
979986
};
987+
988+
/**
989+
* Clears output field.
990+
*/
991+
this.clear = function() {
992+
993+
// @todo: fix this potentialy wrong code
994+
dom.clearLogs();
995+
stack = "";
996+
997+
var t = document.createElement("DIV"); // @wrong
998+
t.className = "terminal-message-body terminal-output-body"; // @absolute
999+
dom.objects.output.appendChild(t); // @fix
1000+
target = t; // @todo: fix this
1001+
1002+
};
9801003
9811004
/**
9821005
* Marks down all marked log headers.

0 commit comments

Comments
 (0)