Fix bug when using print() in Shell, add tag to Shell window title indicating selected language
This commit is contained in:
parent
8a5cdb94d1
commit
ceaa9be060
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user