Fix bug when using print() in Shell, add tag to Shell window title indicating selected language

This commit is contained in:
Skylar 2015-06-02 13:16:40 -06:00
parent 8a5cdb94d1
commit ceaa9be060
2 changed files with 849 additions and 840 deletions

View File

@ -231,6 +231,7 @@ public class CodeRunner {
res = "";
}
String result = res + sw.getBuffer().toString().trim();
sw.getBuffer().setLength(0);
return result;
} catch (ScriptException ex) {
return formatEx(ex);

View File

@ -75,6 +75,8 @@ public class Interpreter extends javax.swing.JInternalFrame {
private AutoCompletion jsac = new AutoCompletion(jscomp);
private AutoCompletion pyac = new AutoCompletion(pycomp);
private Interpreter thisobject;
/**
* Creates new form Interpreter
*
@ -82,6 +84,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
* "default".
*/
public Interpreter(String useLang) {
thisobject = this;
initComponents();
// Setup code runner
@ -96,8 +99,10 @@ public class Interpreter extends javax.swing.JInternalFrame {
javascriptMenu.setSelected(false);
pythonMenu.setSelected(true);
pyac.install(inputBox);
setTitle("Shell [python]");
} else {
jsac.install(inputBox);
setTitle("Shell [javascript]");
}
// Set font
@ -439,8 +444,11 @@ public class Interpreter extends javax.swing.JInternalFrame {
private boolean doSpecialCommands() {
switch (code) {
case "clc":
case "clear":
clrOutput();
return false;
case "exit":
thisobject.dispose();
}
// Implement ans command